Skip to content

entity_ref get_component_with_type is slow #2495

@tower120

Description

@tower120

What problem does this solve or what need does it fill?

I'm trying to get components data from EntityIds(Vec<Entity>) with world.get(entity).... I'm experience some "unexpected" performance drop (in compare to Vec<Rc>).

Looking at the code of World::get<T: Component>(&self, entity: Entity) ... there is so much indirection... Getting component index from hashmap, then bursting through 3 indirections to get component "Column", and one branch between storage type.

What solution would you like?

Is it possible to somehow .... prefetch/cache that archetype table_row/column?

That's just too much... Thats waaaay slower then just cache misses with Rc.

Additional context

I use Vec<Entity> not that often... But sometimes you just have to use it ....

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-PerformanceA change motivated by improving speed, memory usage or compile times

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions