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

Add additional params to EntityManager constructor #80

Open
GGAlanSmithee opened this issue Aug 1, 2018 · 0 comments
Open

Add additional params to EntityManager constructor #80

GGAlanSmithee opened this issue Aug 1, 2018 · 0 comments
Assignees
Milestone

Comments

@GGAlanSmithee
Copy link
Owner

The EntityManagers public API is (subjectively) pretty straight-forward and easy to consume. This is something that I want to preserve. However, there are plenty of room of making the interal operations of it adjustable through some configurations.

Idea

var entityManager = EntityManager(options)

options

An Object (or undefined) of options which drives certain behaviours of the EntityManager.

const options = {
    capacity: number | undefined, // default 1000
    autoAdjust: true | false | undefined, // default false
    lazy: true | false | undefined, // default false
}

options.capacity

The initial capacity (number of entities) of the entity manager.

options.autoAdjust

Wether the capacity (number of entities) should grow / shrink as entities are added / removed. When set to true, the list of entities would;

  1. double in size if all enteties are used
  2. shrink to 3/4 size if half of all entities are un-used

options.lazy

Wether all entities should be eagerly pre-instantiated (false) or lazily instatiated as an entity is created (true). This is a tradeof of speed vs memory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant