adding default capacities to avoid lots of initial runtime resizing
parent
65e5ea2ec0
commit
c11b5720b7
|
@ -6,7 +6,7 @@ namespace Encompass
|
||||||
{
|
{
|
||||||
internal class ComponentStore
|
internal class ComponentStore
|
||||||
{
|
{
|
||||||
private Dictionary<Type, TypedComponentStore> Stores = new Dictionary<Type, TypedComponentStore>();
|
private Dictionary<Type, TypedComponentStore> Stores = new Dictionary<Type, TypedComponentStore>(512);
|
||||||
|
|
||||||
public IEnumerable<(Type, TypedComponentStore)> StoresEnumerable()
|
public IEnumerable<(Type, TypedComponentStore)> StoresEnumerable()
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,8 +15,8 @@ namespace Encompass
|
||||||
|
|
||||||
internal class TypedComponentStore<TComponent> : TypedComponentStore where TComponent : struct, IComponent
|
internal class TypedComponentStore<TComponent> : TypedComponentStore where TComponent : struct, IComponent
|
||||||
{
|
{
|
||||||
private readonly Dictionary<Entity, TComponent> store = new Dictionary<Entity, TComponent>();
|
private readonly Dictionary<Entity, TComponent> store = new Dictionary<Entity, TComponent>(128);
|
||||||
private readonly Dictionary<Entity, int> priorities = new Dictionary<Entity, int>();
|
private readonly Dictionary<Entity, int> priorities = new Dictionary<Entity, int>(128);
|
||||||
|
|
||||||
public override int Count { get => store.Count; }
|
public override int Count { get => store.Count; }
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace Encompass
|
||||||
private readonly ComponentStore pendingComponentStore = new ComponentStore();
|
private readonly ComponentStore pendingComponentStore = new ComponentStore();
|
||||||
private ComponentStore upToDateComponentStore = new ComponentStore();
|
private ComponentStore upToDateComponentStore = new ComponentStore();
|
||||||
|
|
||||||
private readonly Dictionary<Type, Dictionary<Entity, int>> typeToEntityToPendingComponentPriority = new Dictionary<Type, Dictionary<Entity, int>>();
|
private readonly Dictionary<Type, Dictionary<Entity, int>> typeToEntityToPendingComponentPriority = new Dictionary<Type, Dictionary<Entity, int>>(128);
|
||||||
|
|
||||||
public ComponentStore UpToDateComponentStore { get => upToDateComponentStore; }
|
public ComponentStore UpToDateComponentStore { get => upToDateComponentStore; }
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,10 @@ namespace Encompass
|
||||||
{
|
{
|
||||||
private readonly SortedList<int, int> layerOrder = new SortedList<int, int>();
|
private readonly SortedList<int, int> layerOrder = new SortedList<int, int>();
|
||||||
|
|
||||||
private readonly Dictionary<int, ComponentStore> layerIndexToComponentStore = new Dictionary<int, ComponentStore>();
|
private readonly Dictionary<int, ComponentStore> layerIndexToComponentStore = new Dictionary<int, ComponentStore>(512);
|
||||||
private readonly Dictionary<int, HashSet<GeneralRenderer>> layerIndexToGeneralRenderers = new Dictionary<int, HashSet<GeneralRenderer>>();
|
private readonly Dictionary<int, HashSet<GeneralRenderer>> layerIndexToGeneralRenderers = new Dictionary<int, HashSet<GeneralRenderer>>(512);
|
||||||
|
|
||||||
private readonly Dictionary<Type, Dictionary<Entity, int>> typeToEntityToLayer = new Dictionary<Type, Dictionary<Entity, int>>();
|
private readonly Dictionary<Type, Dictionary<Entity, int>> typeToEntityToLayer = new Dictionary<Type, Dictionary<Entity, int>>(512);
|
||||||
|
|
||||||
public IEnumerable<int> LayerOrder { get { return layerOrder.Values; } }
|
public IEnumerable<int> LayerOrder { get { return layerOrder.Values; } }
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,9 @@ namespace Encompass
|
||||||
{
|
{
|
||||||
internal class EntityManager
|
internal class EntityManager
|
||||||
{
|
{
|
||||||
private readonly Dictionary<Guid, Entity> IDToEntity = new Dictionary<Guid, Entity>();
|
private readonly Dictionary<Guid, Entity> IDToEntity = new Dictionary<Guid, Entity>(1024);
|
||||||
|
|
||||||
private readonly HashSet<Entity> entitiesMarkedForDestroy = new HashSet<Entity>();
|
private readonly HashSet<Entity> entitiesMarkedForDestroy = new HashSet<Entity>(256);
|
||||||
|
|
||||||
private readonly ComponentManager componentManager;
|
private readonly ComponentManager componentManager;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace Encompass
|
||||||
private readonly DrawLayerManager drawLayerManager;
|
private readonly DrawLayerManager drawLayerManager;
|
||||||
private readonly EntityManager entityManager;
|
private readonly EntityManager entityManager;
|
||||||
|
|
||||||
private readonly Dictionary<Type, Action<Entity, IComponent>> drawComponentTypeToOrderedRenderer = new Dictionary<Type, Action<Entity, IComponent>>();
|
private readonly Dictionary<Type, Action<Entity, IComponent>> drawComponentTypeToOrderedRenderer = new Dictionary<Type, Action<Entity, IComponent>>(256);
|
||||||
|
|
||||||
public RenderManager(
|
public RenderManager(
|
||||||
ComponentManager componentManager,
|
ComponentManager componentManager,
|
||||||
|
|
Loading…
Reference in New Issue