Re: RFR: 8197594 - String and character repeat

2018-02-15 Thread Louis Wasserman
I don't think there's a case for demand to merit having a repeat(CharSequence, int) at all. I did an analysis of usages of Guava's Strings.repeat on Google's codebase. Users might be rolling their own implementations, too, but this should be a very good proxy for demand. StringRepeat_SingleConst

Re: RFR(m): 8177290 add copy factory methods for unmodifiable List, Set, Map

2017-11-01 Thread Louis Wasserman
I disagree, actually. Collections with size zero and one are significantly more common than bigger collections. In Guava's immutable collection factories (ImmutableList.of(...) etc.), we observed a roughly exponential decline in the number of users of factory methods of each size: if N people cre

Re: RFR: 8166365: Small immutable collections should provide optimized implementations when possible

2017-01-11 Thread Louis Wasserman
I haven't followed this much, but an observation: in Guava, we avoided creating lots of specialized implementations for small collections, because the JVM, at least at the time, had a sweet spot for bimorphic dispatch: method calls where the real implementation would be one of two options, and that

Re: ParallelStream Vs Stream Digest, Vol 113, Issue 94

2016-09-29 Thread Louis Wasserman
You should absolutely not assume parallel streams are faster than sequential streams. http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html is pretty much the iconic document on that subject, and explains circumstances under which parallelism is good, and when it is likely to be harmful. On

Re: Make iterators cloneable?

2016-09-10 Thread Louis Wasserman
Some iterators might be. Many may not be. Certainly Iterator as an interface has been out there for long enough there are Iterator implementations out there that aren't cloneable -- say, Iterators reading from a BufferedReader, where there really won't be any way to do what you're hoping for; Buf

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

2016-05-05 Thread Louis Wasserman
Where is the current commitment to unspecified iteration order? Is that in Java 9? Generally speaking, I see no problem with going from unspecified to specified iteration order; if code had to be able to deal with *any* order previously they can certainly deal with an order that happens to be the

Re: [9] RFR of 8032027: Add BigInteger square root methods

2015-12-09 Thread Louis Wasserman
Guava's tests check the explicit definition of square root (mentioned by Joe above) on 2^n +/- 1 for all n up to Double.MAX_EXPONENT + 1, because why not? On Wed, Dec 9, 2015 at 6:12 PM Joseph D. Darcy wrote: > Hi Brian, > > New version looks good. > > One more case to try: start with a BigInteg

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-10 Thread Louis Wasserman
I'm unclear on whether the question is where Guava stopped, or why we included the fixed-args versions as well as the varargs versions? Part of the answer, of course, is that those factories predate @SafeVarargs, and frankly even now Guava doesn't really depend on Java 7. If you're asking about w

Re: [9] RFR of 8032027: Add BigInteger square root methods

2015-10-02 Thread Louis Wasserman
lues less than Double.MAX_VALUE but this is a first stab at the > implementation so hopefully such improvement may be brought in later if it > is not in the first pass. > > Thanks, > > Brian > > On Oct 2, 2015, at 1:54 PM, Louis Wasserman wrote: > > > Have you investigat

Re: [9] RFR of 8032027: Add BigInteger square root methods

2015-10-02 Thread Louis Wasserman
Have you investigated Guava's really quite tightly optimized implementation here? https://github.com/google/guava/blob/master/guava/src/com/google/common/math/BigIntegerMath.java#L242 A few years back I submitted a patch (now applied) to make BigInteger.doubleValue() very fast. If I recall corre

Re: RFR: 8079136: Accessing a nested sublist leads to StackOverflowError

2015-05-05 Thread Louis Wasserman
Just checking -- IIRC, this will change the semantics of how structural modifications to a subList of a subList will affect the first subList. For example, I believe in the past, removing an element from a subList of a subList would decrease the size of the first subList by 1, but now the first su

Re: String concatenation tweaks

2015-04-07 Thread Louis Wasserman
to be safe, this would > have to be a special kind of StringBuilder. Like the following: > > > http://cr.openjdk.java.net/~plevart/misc/ThreadLocalStringBuilder/webrev.01/ > > Such class would be useful for direct API use too. > > > Regards, Peter > > > On 03/13/201

Re: RFR 8071670: java.util.Optional: please add a way to specify if-else behavior

2015-02-12 Thread Louis Wasserman
's codebase for what usages of Guava's Optional look like, in terms of how often if (optional.isPresent()) { ... } else { ... } occurs, relative to if (optional.isPresent()) { ... } // no else On Thu Feb 12 2015 at 10:15:45 AM Paul Sandoz wrote: > > On Feb 12, 2015, at 7:

Re: Optimization 2.0 for composing strings - Was: Replace concat String to append in StringBuilder parameters

2014-09-08 Thread Louis Wasserman
2:17, Ulf Zibis wrote: >>>>> >>>>> I mean: >>>>>> It does not output byte code that only uses a single char array to >>>>>> compose the entire String in question. >>>>>> With "optimization fails", I also mean, there is used an additional >>>>>> "StringComposer" e.g. another StringBuilder or a StringJoiner in addition >>>>>> to the 1st StringBuilder. >>>>>> >>>>>> -Ulf >>>>>> >>>>>> Am 27.08.2014 um 14:02 schrieb Pavel Rappo: >>>>>> >>>>>>> Could you please explain what you mean by "javac optimization fails" >>>>>>> here? >>>>>>> >>>>>>> -Pavel >>>>>>> >>>>>>> On 27 Aug 2014, at 10:41, Ulf Zibis wrote: >>>>>>> >>>>>>> 4.) Now we see, that javac optimization fails again if >>>>>>>> StringBuilder, concatenation, toString(), append(String), >>>>>>>> append(Collection) etc. and StringJoiner use is mixed. >>>>>>>> >>>>>>> > -- Louis Wasserman

Re: FYC: 7197183 : Provide CharSequence.subSequenceView which allows for sub-sequence views of character sequences.

2014-07-16 Thread Louis Wasserman
e from which the sub-sequence is > + * derived. > + * @param startInclusive The index of the character in the source > character > + * sequence which will be the first character in the sub-sequence. > + * @param endExclusive A supplier which returns the index after the > last the > + * character in the source character sequence which will be the last > + * character in the sub-sequence > + * @return the character sub-sequence. > + * @since 1.9 > + */ > +static CharSequence subSequenceView(CharSequence source, int > startInclusive, IntSupplier endExclusive) { > +return new CharSubSequenceView(source, startInclusive, > endExclusive); > +} > } > > -- Louis Wasserman

Re: DecimalFormat rounding changes in 8 (JEP 177)?

2014-05-04 Thread Louis Wasserman
What does new BigDecimal(1.035).toString() print? I suspect your issue is related to the fact that 1.035 is not, in fact, the value represented as a double; new DecimalFormat("0.00").format(1.035) formats the closest value representable as a double to the exact value 1.035. Louis

Re: ArrayList.removeAll()/retainAll()

2014-02-04 Thread Louis Wasserman
I don't follow. It looks like ArrayList is throwing an exception on removeAll(null) -- perfectly valid, in the spec -- not throwing an exception when the collection contains null. Louis Wasserman wasserman.lo...@gmail.com http://profiles.google.com/wasserman.louis On Tue, Feb 4, 2014 at

Re: RFR [8011215] optimization of CopyOnWriteArrayList.addIfAbsent()

2013-04-02 Thread Louis Wasserman
On Tue, Apr 2, 2013 at 3:36 PM, Louis Wasserman wrote: > I would be deeply suspicious of benchmarks that naive, especially for > benchmarks like this that involve lots of allocation -- you're most likely > benchmarking the GC, not the actual operation. > Sorry, let me clarify:

Re: RFR [8011215] optimization of CopyOnWriteArrayList.addIfAbsent()

2013-04-02 Thread Louis Wasserman
ows a little performance gain - approximately 9%. >> I understand it may not be there for all cases, but at least for >> some cases it is there. >> >> > -- Louis Wasserman

Re: [concurrency-interest] RFR [8011215] optimization of CopyOnWriteArrayList.addIfAbsent()

2013-04-02 Thread Louis Wasserman
s native System.arraycopy(), which is probably faster than >> copying elements in the loop. >> >> Sincerely yours, >> Ivan >> >> __**_ >> Concurrency-interest mailing list >> Concurrency-interest@cs.**oswego.edu >> >> <mailto:Concurrency-interest@**cs.oswego.edu >> > >> >> http://cs.oswego.edu/mailman/**listinfo/concurrency-interest<http://cs.oswego.edu/mailman/listinfo/concurrency-interest> >> >> >> > -- Louis Wasserman

Re: java encoding charset suggestion

2013-03-18 Thread Louis Wasserman
LANG LANGUAGE GDM_LANG; locale) > > LANG= > > LANGUAGE= > > LC_CTYPE="POSIX" > > LC_NUMERIC="POSIX" > > LC_TIME="POSIX" > > LC_COLLATE="POSIX" > > LC_MONETARY="POSIX" > > LC_MESSAGES="POSIX" > > LC_PAPER="POSIX" > > LC_NAME="POSIX" > > LC_ADDRESS="POSIX" > > LC_TELEPHONE="POSIX" > > LC_MEASUREMENT="POSIX" > > LC_IDENTIFICATION="POSIX" > > LC_ALL= > > > > > > On Mon, Mar 18, 2013 at 11:09 AM, Helio Frota >wrote: > > > >> > >> I would suggest taking en_US.UTF-8 as default when the LANG variable is > >> not > >> set to avoid problems with encoding. > >> > > > > > -- > Helio Frota > http://www.heliofrota.com/ > -- Louis Wasserman

Re: RFR : JDK-8001642 : Add Optional, OptionalDouble, OptionalInt, OptionalLong

2013-03-08 Thread Louis Wasserman
alize this will get a good > workout once the streams work come in. > > Now added. > > Thanks! -- Louis Wasserman

Re: [PATCH] Sunbug 7131192: Optimize BigInteger.doubleValue(), floatValue()

2013-02-25 Thread Louis Wasserman
aware of all the > linkages. > > I am actually also wondering whether the patch for 7032154 "Performance > tuning of sun.misc.FloatingDecimal/FormattedFloatingDecimal," which I just > learned of today, should perhaps be dealt with prior to any of the above? > > Thanks, > > Brian > -- Louis Wasserman

Re: [PATCH] Sunbug 7131192: Optimize BigInteger.doubleValue(), floatValue()

2013-02-22 Thread Louis Wasserman
has to > precede that for 7131192 if the latter is deemed correct. > > B. > -- Louis Wasserman

Re: [PATCH] Sunbug 7131192: Optimize BigInteger.doubleValue(), floatValue()

2013-02-22 Thread Louis Wasserman
head of my queue. Given > that I still have a ways to go to get up to speed on this entire topic area > and code base, I would hesitate to give a date estimate just yet. > > > > Brian > > > >> Any update on when this could get reviewed? > >> > >> &g

Re: [PATCH] Sunbug 7131192: Optimize BigInteger.doubleValue(), floatValue()

2013-02-14 Thread Louis Wasserman
Any update on when this could get reviewed? On Thu, Dec 13, 2012 at 3:36 PM, Louis Wasserman wrote: > Hi, > > I'm working at Google now, but I'd like to revive this patch as a > contribution from Google. At the moment, what's mainly needed is review > for http://b

Re: JDK 8 code review request for 6964528: Double.toHexString(double d) String manipulation with + in an append of StringBuilder

2013-02-01 Thread Louis Wasserman
subnormal uses > // E_min -1). > -answer.append("p" + (subnormal ? > - DoubleConsts.MIN_EXPONENT: > - Math.getExponent(d) )); > +answer.append(subnormal ? > + DoubleConsts.MIN_EXPONENT: > + Math.getExponent(d)); > } > return answer.toString(); > } > > -- Louis Wasserman

Re: Codereview request for 8006295: Base64.Decoder.wrap(java.io.InputStream) returns InputStream which throws unspecified IOException on attempt to decode invalid Base64 byte stream

2013-01-31 Thread Louis Wasserman
pal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > lance.ander...@oracle.com > > > -- Louis Wasserman

Re: RFR 8005311: Add Scalable Updatable Variables, DoubleAccumulator, DoubleAdder, LongAccumulator, LongAdder

2013-01-07 Thread Louis Wasserman
lators >>Does the 'identity' value need further explanation? >> >> Note: There is one minor change to the implementation. Currently in the >> jdk8 repo j.u.f.DoubleBinaryOperator defines operateAsDouble. This method >> has been renamed to applyAsDouble in the lambda/lambda repo. When these >> changes are sync'ed from lambda/lambda this can be reverted. A similar >> comment has been added to the code. >> >> -Chris. >> > > -- Louis Wasserman

Re: JDK 8 code review request for 8005042 Add Method.isDefault to core reflection

2012-12-18 Thread Louis Wasserman
Could we say that, in so many words, in the Javadoc? On Tue, Dec 18, 2012 at 4:12 PM, David Holmes wrote: > On 19/12/2012 8:40 AM, Louis Wasserman wrote: > >> It's not 100% obvious to me whether this refers to a default >> implementation >> in an interface, a clas

Re: JDK 8 code review request for 8005042 Add Method.isDefault to core reflection

2012-12-18 Thread Louis Wasserman
hod.toString(), expected, actual); >> >> A typo 'isDefualt' -> 'isDefault'. This uses two single-quote characters >> to wrap the expected and actual value - is it intentional? I was wondering >> that you meant to use one singe-quote character. >> >> Mandy >> >> > -- Louis Wasserman

Re: [PATCH] Sunbug 7131192: Optimize BigInteger.doubleValue(), floatValue()

2012-12-13 Thread Louis Wasserman
he patch to optimize BigInteger.floatValue() and doubleValue(). > Would anyone be able to review that patch so these can start moving forward? Thanks, > Louis Wasserman Java Core Libraries Team @ Google guava-libraries.googlecode.com -- Forwarded message -- > From: Loui

Re: [PATCH] Sunbug 7131192: Optimize BigInteger.doubleValue(), floatValue()

2012-07-14 Thread Louis Wasserman
ided tests at the moment, but that is truly because the reference implementation it's being tested against is faulty.) Louis Wasserman wasserman.lo...@gmail.com http://profiles.google.com/wasserman.louis On Sat, Jul 14, 2012 at 2:20 AM, Joseph Darcy wrote: > Hello, > > Th

[PATCH] Sunbug 6358355: Rounding error in Float.parseFloat

2012-07-12 Thread Louis Wasserman
revealed this bug.) Louis Wasserman wasserman.lo...@gmail.com http://profiles.google.com/wasserman.louis

Re: [PATCH] Sunbug 7131192: Optimize BigInteger.doubleValue(), floatValue()

2012-07-12 Thread Louis Wasserman
y implement the HALF_EVEN rounding behavior with bit twiddling. That said, I *did* encounter places where prior erroneous behavior (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6358355) of Float.parseFloat caused my correct implementation to fail tests... Louis Wasserman wasserman.lo...

[PATCH] Sunbug 7131192: Optimize BigInteger.doubleValue(), floatValue()

2012-07-11 Thread Louis Wasserman
s the speed of those methods by something like two orders of magnitude in my benchmarks. Louis Wasserman wasserman.lo...@gmail.com http://profiles.google.com/wasserman.louis

Float.parseFloat rounding patch

2012-02-08 Thread Louis Wasserman
ow_bug.cgi?id=100208, and I was advised to contact this mailing list to get it reviewed. What do I need to do? Louis Wasserman wasserman.lo...@gmail.com http://profiles.google.com/wasserman.louis