Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR optimizes assembly speed by approximately 10% through performance improvements in string comparison operations. The changes replace inefficient LINQ operations with direct HashSet lookups and standardize string comparisons to use the more efficient string.Equals method.
- Converted
RegisterAndFlagNamesandInstructionNamesarrays to HashSet with case-insensitive comparer for O(1) lookup performance - Replaced
string.Comparewithstring.EqualsusingStringComparison.OrdinalIgnoreCasefor more efficient and clearer case-insensitive comparisons - Eliminated LINQ
Where().Any()patterns in favor of directHashSet.Contains()calls
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| AILZ80ASM/InstructionSet/Z80.cs | Updated to use HashSet for RegisterAndFlagNames with case-insensitive comparer |
| AILZ80ASM/InstructionSet/InstructionSet.cs | Changed RegisterAndFlagNames and InstructionNames from arrays to HashSets for faster lookups |
| AILZ80ASM/InstructionSet/ISA.cs | Optimized IsMatchRegisterName and IsMatchInstructionName methods to use HashSet.Contains instead of LINQ Where + Any |
| AILZ80ASM/Assembler/AsmLoad.cs | Replaced string.Compare with string.Equals in FindGlobalLabelName and FindLabels methods for improved performance |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Owner
|
ありがとうございます。1月にイベントがありそちらの準備でこちらまで手が回りませんので、申し訳ございませんが、1月中旬ぐらいに確認をさせていただきます。また、.NET 10化も計画しておりましたので、問題が発生しなければその時にあげたいと思います。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
アセンブル速度高速化しました。ベンチマーク上は10%程度早くなっています。
私の環境でのベンチマーク結果も参考に載せます。
あと、コミットには入れていませんが、dotnet 10にするとさらに10%程度早くなりました。
参考までにそのベンチマークも載せておきます。
また、お時間のあるときに、よろしくお願いいたします。
AILZ80ASM.Benchmark
dotnet 8
dotnet 10