-
Notifications
You must be signed in to change notification settings - Fork 24
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
Save StringConcat bytecode generation for one-time operation #317
base: main
Are you sure you want to change the base?
Conversation
Why not just eliminate the string concatenation and keep the lambda? Keeping the lambda means one less class to load from disk. |
@dmlloyd I have no strong opinion on this, so I can do it like that as well |
👍 it's probably better to keep the fix down to the thing being fixed when possible. |
final PrivilegedAction<Void> action = new PrivilegedAction<>() { | ||
@Override | ||
public Void run() { | ||
final ReaperThread thr = new ReaperThread(); | ||
thr.setName("Reference Reaper #1"); | ||
thr.setDaemon(true); | ||
thr.start(); | ||
return null; | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final PrivilegedAction<Void> action = new PrivilegedAction<>() { | |
@Override | |
public Void run() { | |
final ReaperThread thr = new ReaperThread(); | |
thr.setName("Reference Reaper #1"); | |
thr.setDaemon(true); | |
thr.start(); | |
return null; | |
} | |
}; | |
final PrivilegedAction<Void> action = () -> { | |
final ReaperThread thr = new ReaperThread(); | |
thr.setName("Reference Reaper #1"); | |
thr.setDaemon(true); | |
thr.start(); | |
return null; | |
}; |
This has popup as a bytecode generation operation which can both save memory and CPU time at startup, see
It both save the lambda generation and, most importantly, a useless string concatenation.