Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.albasani.net!.POSTED!not-for-mail From: Michael Jung Newsgroups: comp.lang.java.programmer Subject: Re: java String split() does not work for delimiter "|" ? Date: Sun, 11 Aug 2013 11:12:38 +0200 Organization: albasani.net Lines: 24 Message-ID: <87vc3cvbeh.fsf@golem.phantasia.org> References: <1192221546.937577.276350@t8g2000prg.googlegroups.com> <14c56553-a55c-4410-8a12-2ab215639d2e@googlegroups.com> <4c416073-9f99-425e-9954-d65fe2ad1a76@googlegroups.com> <874naxbzlo.fsf@golem.phantasia.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.albasani.net /+BX7FuOPU1Q5Pa1OS2KvTHyvo2t/0pUKz9XzkO90kBtmGBjcS7tQ0/lHco8OVzHm4vMRqfuy8oZqSEwtyDEuwFsdXK4tO6oJZF6D+Z5+GVcNmtzTQCQx5PNAnFmQjxz NNTP-Posting-Date: Sun, 11 Aug 2013 09:12:38 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="Qk8+P4d8pxfH8PkJQKPHLYT1nR5OnqpKj9Sc7AfVV56bvzCLrEjgN5tNpFAMxcvuRik5zNSIFfS3qnG85RC6xA8F4/civgyYPzWYbXiG97m3bOPX1BKe0QEsWSr7FTfN"; mail-complaints-to="abuse@albasani.net" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:smVYravYek50GjD5h7LCVuHI+AM= sha1:EunXaFDnvKI1LgXeKQToDwZYci8= Xref: csiph.com comp.lang.java.programmer:24949 Arved Sandstrom writes: > On 08/10/2013 07:37 AM, Michael Jung wrote: [...] >> I can confirm that this does matter in business code. We got a 10%-20% >> performance boost by avoiding split for certain use cases that used it a >> lot, not just in micro-optimizing tests. The numbers from Kevin are >> about what we had (although I personally wouldn't show that many decimal >> places that suggest a higher degree of accuracy than is actually >> reasonable). > I don't doubt that use of String.split is not always the optimal > approach. From the sounds of it it's not often the optimal > approach. But I'll bet that the large majority of the time using it is > a "good enough" approach, because very often that extra 10-20 percent > speed bump isn't actually needed. [...] > But I wouldn't eschew String.split as a rule. I doubt most apps care. I use split myself often enough. You can read my response as a case for optimzation surprises. The micro benchmark shows around a 200% boost (3:10), the overall gain was 15%, but the code in question as to the amount of (user-level) code run through was far less than 1% (big "fat" EE application). Michael