Re: RFR: 6323374: (coll) Optimize Collections.unmodifiable* and synchronized*

2021-02-16 Thread Michael Hixson
On Tue, 16 Feb 2021 21:57:43 GMT, Ian Graves wrote: > Modify the `unmodifiable*` methods in `java.util.Collections` to be > idempotent. That is, when given an immutable collection from > `java.util.ImmutableCollections` or `java.util.Collections`, these methods > will return the reference inst

Re: RFR: 8266846: Add java.time.InstantSource

2021-05-15 Thread Michael Hixson
On Thu, 13 May 2021 20:52:33 GMT, Stephen Colebourne wrote: > 8266846: Add java.time.InstantSource src/java.base/share/classes/java/time/InstantSource.java line 68: > 66: * @implSpec > 67: * This interface must be implemented with care to ensure other classes > operate correctly. > 68: * A

Re: RFR: 8279986: methods Math::asXExact for safely checked primitive casts

2022-05-05 Thread Michael Hixson
On Thu, 5 May 2022 10:11:05 GMT, Raffaello Giulietti wrote: > Add a family of "safe" cast methods. This PR also solves [JDK-8154433](https://bugs.openjdk.java.net/browse/JDK-8154433), though you went the other way on -0.0. - PR: https://git.openjdk.java.net/jdk/pull/8548

Re: RFR: 8279986: methods Math::asXExact for safely checked primitive casts

2022-05-05 Thread Michael Hixson
On Thu, 5 May 2022 14:32:36 GMT, Raffaello Giulietti wrote: > So, what is the use case or the rationale for throwing on -0.0? Rationale: It loses information. It truncates the sign, so the value can't be round-tripped. I think it would be the only lossy transformation permitted by the `to*E

Re: RFR: updated draft API for JEP 269 Convenience Collection Factories

2015-11-06 Thread Michael Hixson
This is in reply to: http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-November/036331.html + static List of(E... es) { + for (E e : es) { + Objects.requireNonNull(e); + } + // NOTE: this can allow a null element to slip through + return Col

Re: RFR: updated draft API for JEP 269 Convenience Collection Factories

2015-11-07 Thread Michael Hixson
some quick benchmarks comparing explicit versus varargs implementations just to see the impact for myself. The output and source code are included at the end of the email. -Michael On Fri, Nov 6, 2015 at 10:28 AM, Stuart Marks wrote: > On 11/6/15 5:12 AM, Michael Hixson wrote: >> &

Re: RFR: updated draft API for JEP 269 Convenience CollectionFactories

2015-11-07 Thread Michael Hixson
4-bit or 32-bit? > > > > > > > > (1)Actually, it almost looks like even arguments are more than free and > come with a small discount. Passing a dummy argument to make the number even > doesn’t look like it would hurt. > > > > > > > > Sent

Re: RFR: updated draft API for JEP 269 Convenience Collection Factories

2015-11-08 Thread Michael Hixson
I think the mailing list stripped my attachments, so I put it up on github: https://github.com/michaelhixson/jmh-benchmark-listof -Michael On Sun, Nov 8, 2015 at 2:55 PM, Michael Hixson wrote: > Hi Peter, > > You're right. I see the same thing running that locally. Nice work! &

Re: RFR: updated draft API for JEP 269 Convenience Collection Factories

2015-11-08 Thread Michael Hixson
gt 10 > 88.000 ±0.001B/op > ListOf.varargs_switch2_05:·gc.alloc.rate.normavgt 10 > 104.000 ±0.001B/op > ListOf.varargs_switch2_06:·gc.alloc.rate.normavgt 10 > 104.000 ±0.001B/op > ListOf.varargs_switch2_07:·gc.alloc.rate.

Re: RFR: updated draft API for JEP 269 Convenience Collection Factories

2015-11-09 Thread Michael Hixson
Hi Stuart, I don't know if I have any new information to add. When I try to solve this equation, I: - Look at the difference between fixed-arg and non-optimized varargs from my benchmarks (allocating an array doesn't get faster with JIT optimizations, does it?), which is on the order of tens of

Re: RFR(m): updated: JEP 269 initial API and skeleton implementation (JDK-8139232)

2015-12-07 Thread Michael Hixson
On Mon, Dec 7, 2015 at 4:19 PM, Stuart Marks wrote: > Hi Maurizio, > > Well, maybe we should add five more overloads to EnumSet.of()? (Only > slightly joking here.) > > Setting aside the number of overloads, it would add N more overloads to > Set.of(). I guess the erasure of > would be Enum, so th

default random access list spliterator

2016-03-07 Thread Michael Hixson
The default List.spliterator() is iterator-based. Could this be improved for random access lists, using List.get(int) to fetch elements instead of List.iterator()? I think it could improve most on Spliterator.trySplit(). The current implementation allocates a new array for split-off elements. I

Re: default random access list spliterator

2016-03-07 Thread Michael Hixson
t (which > may be a reasonable compromise in the case, it should be possible to detect > certain co-mod cases) > > Paul. > > [1] > http://mail.openjdk.java.net/pipermail/lambda-libs-spec-experts/2013-May/001770.html > > <http://mail.openjdk.java.net/pipermail/lambda-lib

Re: JEP 118 Parameter Names by default

2016-04-27 Thread Michael Hixson
I found this old email reply to someone who asked a similar question. Maybe the same reasoning still applies: http://mail.openjdk.java.net/pipermail/enhanced-metadata-spec-discuss/2013-May/000201.html -Michael On Wed, Apr 27, 2016 at 1:18 PM, Steven Schlansker wrote: > Hi core-libs-dev, > > Apo

Re: RFR(m): 8139233u1 add initial compact immutable collection implementations

2016-05-05 Thread Michael Hixson
Hi Stuart, In MapN.entrySet(), is the "int idx" being declared in the wrong place? It looks like it should be a field of the Iterator rather than the Set. @Override public Set> entrySet() { return new AbstractSet>() { int idx = 0; // <-- this...

Re: Raw String Literal Library Support

2018-03-14 Thread Michael Hixson
Hi Jim, Does string.lines() agree with new BufferedReader(new StringReader(string)).lines() on what the lines are for all inputs? For example, does ``.lines() produce an empty stream? -Michael On Tue, Mar 13, 2018 at 6:47 AM, Jim Laskey wrote: > With the announcement of JEP 326 Raw String Liter

Re: Raw String Literal Library Support

2018-03-16 Thread Michael Hixson
On Fri, Mar 16, 2018 at 8:58 AM, Stephen Colebourne wrote: > On 14 March 2018 at 23:05, Michael Hixson wrote: >> For example, does ``.lines() produce an empty stream? > > I believe `` is a compile error. > (A mistake IMO, but necessary if you have unlimited delimiters) Ah, oop

default methods inherited by EnumSet and EnumMap

2016-12-06 Thread Michael Hixson
Hello, I notice that EnumSet and EnumMap don't override any of the default methods that were added to collections in Java 8. Were they specifically considered then avoided during the Java 8 upgrades, or was it simply that no one got around to optimizing them? Are there existing issues/bugs for o

Re: CFR - updated 8001667: Comparator combinators and extension methods

2013-03-06 Thread Michael Hixson
Hello, I'm not one of the people that you're looking at to review this, but I have to give this feedback anyway. I tried to give similar feedback on another mailing list and got no response (maybe I chose the wrong list). These changes have been bothering me. :) 1. Why disable the following cod

Re: CFR - updated 8001667: Comparator combinators and extension methods

2013-03-07 Thread Michael Hixson
On Wed, Mar 6, 2013 at 1:01 PM, Henry Jen wrote: > On 03/06/2013 02:31 AM, Michael Hixson wrote: > >> 1. Why disable the following code even though it is (theoretically) safe? >> >> Comparator a = comparing(CharSequence::length); >> Comparator b = a.thenCo

Re: CFR - updated 8001667: Comparator combinators and extension methods

2013-03-25 Thread Michael Hixson
.apply(Person::getEmailAddress))); > > byKey and byValue is actually added based on the same thought that when > something is not a Comparable. With above, it can be replaced with > > cmp.apply(Map.Entry::getKey); > > This is just inverse thinking of comparing, where the thoug

Re: RFR (2nd round) 8009736: Comparator API cleanup

2013-06-20 Thread Michael Hixson
+ return new NullComparator(nullFirst, real == null ? null : real.thenComparing(other)); Should that be "other" instead of the second "null", like this? + return new NullComparator(nullFirst, real == null ? other : real.thenComparing(other)); Also, if Comparator.nullsFirst(null) and nullsLast(nu