stevehalliwell / ulox

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

Perf if all bytecodes are 32bits #174

Closed stevehalliwell closed 1 year ago

stevehalliwell commented 1 year ago

What if we made all opcodes 32bits, no more no less, if you don't want the extra bytes, ok enjoy your zeros.

Should be easier to move through and rewrite and move around. Makes bytecode iteration trivial.

stevehalliwell commented 1 year ago

Before: image

After: image

stevehalliwell commented 1 year ago

In unity: Before: image

After: image

stevehalliwell commented 1 year ago

It is noticeably slower, but marginally so.

Compiling code is considerably less complicated, and allows for registers to be used for local operations. Since the add is now add 0,0,0, which could become registered bytes.