Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom memory allocator for RPG::Database #256

Open
fmatthew5876 opened this issue Oct 5, 2018 · 0 comments
Open

Custom memory allocator for RPG::Database #256

fmatthew5876 opened this issue Oct 5, 2018 · 0 comments

Comments

@fmatthew5876
Copy link
Contributor

fmatthew5876 commented Oct 5, 2018

When we read RPG_RT.ldb we can read the chunk sizes and actually compute the entire size layout of the database.

  1. Read the chunk sizes of the database to quickly determine the maximum size of the entire RPG::Database.
  2. Perform a single call to operator new() to allocate the entire database.
  3. Layout the data structures onto this single memory allocation. Objects used frequently together in time should be laid out similarly in space.

This would result in the most optimal memory layout possible for the entire database. This would surely produce a measurable increase on frame rates and battery life on mobile devices for Player.

The locality improvements and removal of all memory allocations except one should produce significant performance improvements in reading and writing in liblcf.

This will be perfect for player, but tricky for editor.

In editor you want to do more like you would with vectors. So you can resize things. If you had to reallocate the enitre database every time you changed the size of something in Editor, it would be slow and kill the interactivity.

So for editor we'd have to grow our allocation vector style, and amortize the cost of reallocations to keep the editor gui running interactively.

@fmatthew5876 fmatthew5876 changed the title Custom memory allocator for the RPG_RT.ldb database Custom memory allocator for RPG::Database Oct 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants