Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dumpnef performance #1201

Merged
merged 2 commits into from
Oct 10, 2024
Merged

dumpnef performance #1201

merged 2 commits into from
Oct 10, 2024

Conversation

Hecate2
Copy link
Contributor

@Hecate2 Hecate2 commented Oct 9, 2024

I spent almost 1 minute in dumpnef for a huge contract reaching instruction address of 22000. So I profiled dumpnef and made some optimizations...

}
}
}
if (a < script.Length)
dumpnef += $"{WriteInstruction(a, script.GetInstruction(a), script.GetInstructionAddressPadding(), nef.Tokens)}\n";
dumpnef.Append($"{WriteInstruction(a, script.GetInstruction(a), addressPadding, nef.Tokens)}\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use AppendLine and remove the \n?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. WILCO in 24 hours

@Jim8y
Copy link
Contributor

Jim8y commented Oct 10, 2024

what is the performance improvement

@Jim8y Jim8y merged commit ae0695a into neo-project:master Oct 10, 2024
4 checks passed
@Jim8y Jim8y deleted the dumpnef-performance branch October 10, 2024 08:56
@Hecate2
Copy link
Contributor Author

Hecate2 commented Oct 10, 2024

what is the performance improvement

string addressPadding enumerates instructions only once instead of many times
StringBuilder is much faster than string addition when there are many strings

@Jim8y
Copy link
Contributor

Jim8y commented Oct 10, 2024

hat is the performance improvement

I mean what is the perforamcne after this pr.

@Hecate2
Copy link
Contributor Author

Hecate2 commented Oct 10, 2024

hat is the performance improvement

I mean what is the perforamcne after this pr.

< 1 second. Negligible time compared to compilation.

@shargon
Copy link
Member

shargon commented Oct 10, 2024

what is the performance improvement

stringbuilder it's much faster than string concat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants