-
-
Notifications
You must be signed in to change notification settings - Fork 375
Open
Labels
Description
Describe the bug
So apparently, the PrettyPrinter can now change the contents of an element. Ignoring if this is a good idea or not (seems pretty bad at first glance), this means that the toString method now clones itself before passing itself to the PrettyPrinter. This results in significantly reduced performance when turning an element back into code.
Perhaps a different, faster method for producing code or perhaps rethink allowing the PrettyPrinter to change an Element's contents.
Either way, please make the toString method faster and cause it not to use so much memory. Perhaps even make it not use String but instead take a StringBuilder so the strings don't get internalized and consume so much memory.
Source code you are trying to analyze/transform
// The biggest Java file you can findSource code for your Spoon processing
Launcher l = new Launcher();
l.addInputResource(new FileSystemFile("ReallyBig.java"));
CtType tpe = l.buildModel().getAllTypes().get(0);
System.out.println("time to start the profiler");
Thread.sleep(15000);
tpe.toString();Actual output
N/AExpected output
N/ASpoon Version
11.2.1
JVM Version
java 17
What operating system are you using?
Ubuntu