JS: Refactor CFGExtractor.java#6406
Conversation
…dIterable` respectively
asgerf
left a comment
There was a problem hiding this comment.
Yes!!! 💪 This is seriously excellent work! 👏
The one thing I'm not so sure about is rewriting some hot methods to have shorter but potentially slower implementations. End-to-end benchmarking is dominated by other factors like TRAP writing, so behind the noise we can't really see how the performance of the CFG extractor was affected. Would you mind benchmarking it more closely, or just reverting those particular changes?
|
dca can collect the data for us, but we need to make a custom report generator to display the diff. |
I did that experiment on I'll see if removing some streams and adding some more special cases helps. |
| private static Collection<Node> nonNullUnion(Collection<Node> xs, Collection<Node> ys) { | ||
| List<Node> result = new ArrayList<>(xs); | ||
| for (Node y : ys) { | ||
| if (!result.contains(y)) { |
There was a problem hiding this comment.
I know, but n is always small.
I did an experiment trying to extract Microsoft/vscode, and n was at most 3.
My idea was to avoid allocating a HashSet.
Also, it's basically what the implementation did before my refactor.
The CFG extraction got slightly faster from the last few commits, but still around 3% slower than before my refactor. |
I considered taking a look at #6362
But the code in
CFGExtractor.javawasn't that readable.So before I start fixing bugs, I went ahead and refactored
CFGExtractor.java.Objecttypes. I changed all of those to more descriptive types (mostlyCollection<Node>).visitSequencestill works with raw types. I don't think we would gain anything by refactoring that method any further.hcaerof,V,seq,succ. I tried to use more descriptive names.No behavior change.
An evaluation looks good (no increase in extraction time).
This is based on a refactor I tried to do last year but never finished.