You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
consumes a large amount of time, because the Elements.Count property getter is actually O(N). The while-loop condition is false most of the time, but there's an outer loop adding to container.Peek().Elements, so an array initializer with N elements performs N get_Count calls, taking O(N²) overall time.
InsertSpecialsDecorator.WriteSpecialsUpToRole()
Here we are looking for the non-existing comma tokens. For each place where there should be a comma we scan all following children, so that's quadratic. The problem is hard to fix given the InsertSpecialsDecorator design, but an easy workaround would be to emit the comma tokens it is looking for.
In the case of the NRefactory roundtrip test, fixing these performance bugs should have a significant impact on the overall decompilation time (at least 25%).
The text was updated successfully, but these errors were encountered:
During profiling I found (at least) two hotspots caused by long array initializers interacting badly with the NRefactory AST design.
The loop condition
consumes a large amount of time, because the
Elements.Count
property getter is actually O(N). The while-loop condition is false most of the time, but there's an outer loop adding tocontainer.Peek().Elements
, so an array initializer with N elements performs N get_Count calls, taking O(N²) overall time.Here we are looking for the non-existing comma tokens. For each place where there should be a comma we scan all following children, so that's quadratic. The problem is hard to fix given the
InsertSpecialsDecorator
design, but an easy workaround would be to emit the comma tokens it is looking for.In the case of the NRefactory roundtrip test, fixing these performance bugs should have a significant impact on the overall decompilation time (at least 25%).
The text was updated successfully, but these errors were encountered: