flag_operations_are_free
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| flag_operations_are_free [2026/01/15 05:29] – appledog | flag_operations_are_free [2026/01/15 05:32] (current) – appledog | ||
|---|---|---|---|
| Line 197: | Line 197: | ||
| let addr = (instruction >> 8) & 0x00FFFFFF; | let addr = (instruction >> 8) & 0x00FFFFFF; | ||
| - | | + | |
| - | You're adding a bit shift, a bitwise AND, plus you're creating an intermediary variable access. In the end this is almost 10% slower than just calling fetch_byte(). | + | You're adding a bit shift, a bitwise AND, plus you're creating an intermediary variable access. In the end this is almost 10% slower than just calling fetch_byte(). |
| | | ||
| == Conclusion | == Conclusion | ||
| Line 229: | Line 229: | ||
| If you want to get faster than this, you need to rewrite the entire switch in C or maybe Rust. | If you want to get faster than this, you need to rewrite the entire switch in C or maybe Rust. | ||
| + | |||
| + | As a result of all this, I now know that flag operations are free inside an opcode and I don't need to have a "fast flags" bit. Simply checking that bit every instruction was slowing down the system by far more than it saved. | ||
| + | |||
| + | //Moral: " | ||
flag_operations_are_free.1768454993.txt.gz · Last modified: by appledog
