Skip to content

Custom memory allocator for RPG::Database #256

Open

Description

@mateofio

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.

Activity

  1. changed the title [-]Custom memory allocator for the RPG_RT.ldb database[/-] [+]Custom memory allocator for RPG::Database[/+] on Oct 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions