Skip to content
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

Truffle perf warnings #4395

Merged
merged 12 commits into from Dec 18, 2016
Merged

Truffle perf warnings #4395

merged 12 commits into from Dec 18, 2016

Conversation

chrisseaton
Copy link
Contributor

  • Fold performance warnings in logging
  • When something isn't optimised, warn about it only if it gets compiled, otherwise they probably won't worry that it's slow anyway
  • With logging levels we don't need an option to disable performance warnings

@chrisseaton chrisseaton added this to the truffle-dev milestone Dec 18, 2016
if (CompilerDirectives.inCompiledCode()) {
performance(message);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this one? It seems unused so far.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using it at the moment. I just added it as another option. Do you think I should remove until we actually use it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's trivial to add if we need it and I'd rather avoid extra methods we don't currently need.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// This isn't double-checked locking, because we aren't publishing an object that is then used

if (!displayedWarnings.contains(message)) {
synchronized (displayedWarnings) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (displayedWarnings.add(message)) is simpler and should not cause a performance difference I think.
Or maybe use putIfAbsent() on the Map directly if you want more control.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just the synchronization could be simpler.

@eregon
Copy link
Member

eregon commented Dec 18, 2016

How does one enable/disable these warnings?

@chrisseaton
Copy link
Contributor Author

I added a sample logging configuration file. It's a little fussy, I'm afraid, but it's the standard Java way.

https://github.com/jruby/jruby/pull/4395/files#diff-790cdfd51b2ae9a0f85753a2a80d02d3

The great thing about using the standard API is that you can change a few configurations and have us play nicely with any other Java framework you might be using.

*/
@TruffleBoundary
public static void performanceOnce(String message) {
// This isn't double-checked locking, because we aren't publishing an object that is then used
Copy link
Member

@eregon eregon Dec 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment can go as well now :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@eregon eregon merged commit 53074f5 into truffle-head Dec 18, 2016
@eregon eregon deleted the truffle-perf-warnings branch December 18, 2016 18:00
@eregon
Copy link
Member

eregon commented Dec 18, 2016

Merged!

@enebo enebo added this to the Non-Release milestone Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants