-
Notifications
You must be signed in to change notification settings - Fork 643
Post migration to JDK 8: Functions, lambdas and others #83
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
Conversation
85befc5
to
a0a9308
Compare
c.set(year, month - 1, day); | ||
return c.getTimeInMillis(); | ||
}); | ||
|
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.
This is an interesting function, I think we don't need a calendar for that, if it could be migrated to JDK 8 to avoid such instantiation.
Also, JDK 8 JSR-310 date & time formatters are now thread safe, I'll see if I can add more of that stuff on Friday, busy days ahead on my other project.
Maybe migrated to JDK 8 will make it faster than calculating the hash for a String look in a Map
Hi @guidomedina , thank you, I will look at it later this week or weekend. |
public V computeIfAbsent(K key) { | ||
/* | ||
* We could computeIfAbsent directly but for CPUs < 32 pre-scanning is faster. | ||
*/ |
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.
Just curious: Shouldn't we then have a code path that directly uses computeIfAbsent if number of CPUs is greater than 32 (for the very rare case ;)).
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.
Maybe is not worth the effort, look at 1st comment on the question:
http://stackoverflow.com/questions/33901070/java-8-concurrent-hash-map-get-performance-alternative
This is actually the recommendation by the Doug Lea the author of ConcurrentHashMap for Java 8 (aka CHMv8):
http://jsr166-concurrency.10961.n7.nabble.com/Re-ConcurrentHashMap-computeIfAbsent-td11687.html
Rebased and added some plugin updates, I was looking at the date time stuff and it will take some effort to do so I think what has been done is good enough for now, later we can comeback to it and migrate more stuff to Java 8. |
Sorry, did not have time yet to take a deeper look, but anyway thanks for the PR. 👍 Just a quick question: does the conversion from for-each-loop to the functional style have any benefit? I do not find it easier to understand. I mean, maybe there are cases where it might be handy, but in this commit it is just the same logic but with a different header. |
I didn't change any for-each, I explicitly left these out, the only functional changes are anonymous classes and functional interfaces which are interfaces with one method that are inferred as functional by Java 8 hence allow you to omit boiler plate code. Almost two years ago I found difficult to understand Java 8, then it becomes very easy. |
I have a custom QFJ 1.7.x compiled version, running what is on master in production for weeks now, no issues, I also introduced a
|
Hi @guidomedina, yes, please open a separate PR. You could also use the PersistMessages=N option to not persist any messages. Cheers, |
Hi @guidomedina , could you please reopen this? I didn't yet merge the JDK8 changes. |
OK, just saw #88 :) |
I split them so that one doesn't interfere with the other. |
Post migration to JDK 8:
There is a new class org.quickfixj.SimpleCache, is it at the right place?