Goubermouche / baremetal

Basic assembler which (currently) supports most x64 instructions, including the AVX and AVX-512 extensions.
MIT License
2 stars 0 forks source link

Optimize instruction selection #2

Open Goubermouche opened 2 months ago

Goubermouche commented 2 months ago

The current instruction selection scheme which is used to locate instructions based off of a list of operands and the mnemonic is very naive and won't scale very well. A (much) more performant algorithm would be nice for this, as this currently takes up most of the runtime.

Potential ideas:

It's most likely smarter to wait until all/most of the instructions are implemented, as there will most likely be edge cases which we'll need to account for, as of now, the edge cases include:

Goubermouche commented 1 month ago

Temp-ish update - binary search, roughly a 40x speedup. Work for now, but implementing a hash-based method would probably still be faster.