Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #11.
A profile of the code revealed a couple inefficiencies. Most of the time in update was spent copying and iterating over vector. The following are a few of the culprits.
Copying a vector:
Astro8-Computer/Astro8-Emulator/main.cpp
Line 435 in 20e25a7
Copying again and iterating:
Astro8-Computer/Astro8-Emulator/main.cpp
Line 448 in 20e25a7
Astro8-Computer/Astro8-Emulator/main.cpp
Lines 935 to 947 in 20e25a7
mcode
is always 14 bits long, which means replacing eachvector<bool>
withuint16_t
is low hanging fruit in terms of optimization. Extracting the int from the bits becomes as simple as a few shifts and a bitmask.This change is enough to make a noticable improvement to most programs. For instance, on my machine the time to run
rainbow_gradient.armstrong
drops from ~3.5s to <0.5s (in the debug build).