Salomonsson.se
Jul 28 2016

TLDR - Part 4: Component filtering BLAZING fast with macros!

Made a huge optimization in the way Seagal filters list of entities that contains specific components!

Using the macro I’ve written two days ago as a base I now use bitflags instead of multiple for-loops and several Std.is(classA, classB). I now just use simple bit-flag comparison as the macro auto-generates a unique bitflag for each component class, and the result is stunning!

I actually had to go back to my old test and change the number of entities from 10,000 to 100,000!!!

The critical part is the last test, taking 0.0469 seconds
The optimized code! 0.012 seconds! Thats 391% faster!!!

Note 1: Both test 2 and test 3 took 0.001 seconds when running 10,000 entities. That’s why I had to increase the number of entities.

Note 2: Test 2 now takes only 0.007 seconds with that huge amount of entities!

Note 3: Running identical test 3 with 100,000 entities on Edge gives an approx time of 0.049 seconds, even slower than my own old solution…

High fiving myself

Jul 26 2016

Haxe Macros, Part 1

When reading up on the Edge-entity system in the post about TLDR I got an idea on how to speed up my Seagal enging a lot using macros. The problem is that macros is a subject with few tutorials and resources online, and it seems a lot of people are afraid to look into it.

I will try to explain what macros are, some good places to start learning more, and a cool example that I’ll expand upon to improve the speed of Seagal!

READ MORE >>