mirror of
https://github.com/fadden/6502bench.git
synced 2024-12-01 07:50:37 +00:00
Performance tweak
The Visual Studio performance profiler showed the FormatDescriptor equality test being called quite a lot. The test was vs. null, so a simple change from "==" to "is" improved performance dramatically. Fixing the underlying issue with a better data structure is still important, but this provided a big boost with little effort.
This commit is contained in:
parent
f4fe3af050
commit
44522dc2f2
@ -360,7 +360,7 @@ namespace SourceGen {
|
|||||||
// If the target offset has a symbol assigned, use it. Otherwise, try to
|
// If the target offset has a symbol assigned, use it. Otherwise, try to
|
||||||
// find something nearby that might be more appropriate.
|
// find something nearby that might be more appropriate.
|
||||||
int origTargetOffset = targetOffset;
|
int origTargetOffset = targetOffset;
|
||||||
if (mAnattribs[targetOffset].Symbol == null) {
|
if (mAnattribs[targetOffset].Symbol is null) {
|
||||||
if (mAnalysisParams.SeekNearbyTargets) {
|
if (mAnalysisParams.SeekNearbyTargets) {
|
||||||
targetOffset = FindAlternateTarget(srcOffset, targetOffset);
|
targetOffset = FindAlternateTarget(srcOffset, targetOffset);
|
||||||
}
|
}
|
||||||
@ -392,7 +392,7 @@ namespace SourceGen {
|
|||||||
int scanOffset = targetOffset;
|
int scanOffset = targetOffset;
|
||||||
while (--scanOffset >= 0) {
|
while (--scanOffset >= 0) {
|
||||||
FormatDescriptor dfd = mAnattribs[scanOffset].DataDescriptor;
|
FormatDescriptor dfd = mAnattribs[scanOffset].DataDescriptor;
|
||||||
if (dfd != null) {
|
if (!(dfd is null)) {
|
||||||
if (scanOffset + dfd.Length > targetOffset) {
|
if (scanOffset + dfd.Length > targetOffset) {
|
||||||
// Found a descriptor that encompasses target offset. Adjust
|
// Found a descriptor that encompasses target offset. Adjust
|
||||||
// target to point at the start of the region.
|
// target to point at the start of the region.
|
||||||
|
Loading…
Reference in New Issue
Block a user