Re: Optimized HashSet.toArray()

2018-10-02 Thread Stuart Marks
Hi Tagir, Thanks for doing this! This looks like a good optimization. I can sponsor it for you. The preliminary patch looks fine. Too bad there's some code duplication. If this weren't HashMap, I'd suggest refactoring it and using a lambda expression. However, HashMap is used early in JDK st

Re: Optimized HashSet.toArray()

2018-10-02 Thread Claes Redestad
Hi, On 2018-10-01 19:35, Martin Buchholz wrote: We probably want to check in the jmh benchmark, but not sure where - there have been recent discussions ... """Reviving JEP 230: Microbenchmark Suite""" we have a prototype up and running in the sandbox[1] and I hope to move forward with the JE

Re: Optimized HashSet.toArray()

2018-10-01 Thread Martin Buchholz
Thanks, Tagir. I agree these optimizations are worth doing. I have worked on similar toArray methods in other Collection implementations. I have a benchmark that is also a correctness test Collection/IteratorMicroBenchmark.java but I never added any Set implementations since I intentionally want