From e23647bb5e62671493c2444d29cae0dcbb22f5f1 Mon Sep 17 00:00:00 2001 From: rowan Date: Sat, 21 Dec 2024 23:40:29 -0600 Subject: [PATCH] add more to performance section in ecs post --- content/blog/on-ecs/index.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/content/blog/on-ecs/index.md b/content/blog/on-ecs/index.md index 2a633f2..c55d1c7 100644 --- a/content/blog/on-ecs/index.md +++ b/content/blog/on-ecs/index.md @@ -123,9 +123,19 @@ While these aren't *really* a separate concept from regular components, they're ### Performance -One thing that I've deliberately not mentioned until now: ECS is usually *very* fast. I often see this touted as one of the main selling points of ECS. It's true that the performance is important to an application which is running anywhere from 60-144 times per second but I think there are *many* other benefits worth talking about. +One thing that I've deliberately not mentioned until now: ECS is generally fast. I often see this touted as one of the main selling points of ECS. It's true that the performance is important to an application which is running anywhere from 60-144 times per second but I think there are *many* other benefits worth talking about. -Most of the performance benefits of ECS are due to its overlap with data-oriented design concepts. One example of data-oriented design, parallel arrays, is a common implementation in many ECS frameworks. I'm *especially* not qualified to speak on this issue because I've very little exposure to the concept separate from using it via ECS in game development, so I'll let others explain it. +Most of the performance benefits of ECS are due to its overlap with data-oriented design concepts. One example of data-oriented design, parallel arrays, is a common implementation in many frameworks. I'm *especially* not qualified to speak on this issue because I've very little exposure to the concept separate from using it in game development, so I'll let someone else explain it. + +> # Is ECS fast? +> +> Generally yes, though this of course depends on what is being measured, and the ECS implementation. Different implementations make different tradeoffs, and as such an operation that is really fast in one framework is quite slow in another. +> +> Things that ECS implementations are generally good at are querying and iterating sets of entities linearly, or dynamically changing components at runtime. Things that ECS implementations are generally not good at are queries or operations that require highly specialized data structures, such as binary trees or spatial structures. Knowing the tradeoffs of an implementation and levering its design ensure you get the most performance out of an ECS. +> +> -- [Sander Mertens](https://github.com/SanderMertens/ecs-faq?tab=readme-ov-file#is-ecs-fast) + +If you want to know more about *why* it's fast, read Sander's article about [how to build ECS](https://ajmmertens.medium.com/building-an-ecs-2-archetypes-and-vectorization-fe21690805f9). ## Theseus' Shield