stevehalliwell / ulox

A bytecode interpreted scripting language for games in Unity.
MIT License
24 stars 0 forks source link

Optimise Table #190

Closed stevehalliwell closed 9 months ago

stevehalliwell commented 1 year ago

We are using Dictionary with HashedString key type:

stevehalliwell commented 1 year ago

Top normal, bottom changing Table to be int key image

stevehalliwell commented 1 year ago

look into https://github.com/Wsm2110/Faster.Map

stevehalliwell commented 1 year ago

we also want to replace use of .net dict as the unity version does not allow foreach look of dict values. That was added in 5.0 apparently.

stevehalliwell commented 1 year ago

chase up

stevehalliwell commented 1 year ago

Tested a refactor of our table class to limit its interface and replace its internals with a linear array. The intent to see how bad the structure could be before spending more time trying to make it good. The impact was only around 15%. This was less than expected and helps put into context the actual cost we are paying in table lookups vs the total execution time.