Shlomi Assaf
Aug 24, 2017 · 1 min read

Antoine, you’re right and there are multiple ways to scale this one up.

You can use flags and start shifting bits and use the same int to represent multiple agents… you can build a complete, top notch data structure that performs like a beast.

There’s a cost though, its harder to understand and maintain the code.

In 99% of the use cases its not the right approach, readability and maintainability gives you more.

Just by using JavaScript (or python) you already agree to that trade-off and it also happens in Java, C# etc…

Doing the most performent thing is, in most cases, not the best thing to do.

)