Optimise out transistor_on and node_block #16
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.
I've been working on a port of perfect6502/visual6502 to Go and have made a couple of optimisations in my own code that you might like for yours.
transistor_onmirrorsnodes_value[gate]for each transistor. By making c1c2 reference the gate node rather than the transistor index, a level of indirection can be avoided.Since the transistor netlist entries in this implementation are ordered by gate
node_blockends up beingnode_block[n] = n, so this can be optimised out. This does mean if you want to use this simulator with any other netlist (i.e. z80, 8080) those netlists will also need to be sorted before use.Lastly
nodes_gatesis now only used in initialisation and can be removed from the state.Testing using
make benchmarkI was able to observe a 3-4% performance gain.