logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remko Popma (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (LOG4J2-1151) Performance improvement: backport fast Java 8 String to byte[] encoder to AbstractStringLayout
Date Mon, 05 Oct 2015 13:23:26 GMT

     [ https://issues.apache.org/jira/browse/LOG4J2-1151?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Remko Popma closed LOG4J2-1151.
-------------------------------

> Performance improvement: backport fast Java 8 String to byte[] encoder to AbstractStringLayout
> ----------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-1151
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1151
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Layouts
>    Affects Versions: 2.4
>            Reporter: Remko Popma
>            Assignee: Remko Popma
>             Fix For: 2.4.1
>
>
> Java 8 made large improvements to String encoding performance for all character sets.
Especially for the ISO8859_1 encoding, Java 8 introduced logic that simply casts each char
in the array to a byte, giving a huge performance increase.
> This ticket proposes to backport that logic into AbstractStringLayout to get the same
performance in Java 7.
> Focussing on the results for ISO8859_1:
> {quote}
> Java 7 String.getBytes(): ~200-300 ns/op
> Java 8 String.getBytes(): ~70-80 ns/op
> Custom logic: ~90 ns/op (on both Java 7 and 8)
> {quote}
> Benchmarks below are with a representative message string of 100 characters, on 64 bit
Windows 10, Dual Intel Core i5-3317U @1.70GHz with hyperthreading on (4 cores).
> *jdk 1.8.0_60 (64 bit Hotspot)*
> {code}
> Benchmark                                                              Mode  Samples
   Score    Error  Units
> o.a.l.l.p.j.StringEncodingBenchmark.customIso8859_1                  sample   156848
  94.014 ±  2.362  ns/op <- custom
> o.a.l.l.p.j.StringEncodingBenchmark.encoderIso8859_1                 sample   103773
 859.529 ± 27.461  ns/op
> o.a.l.l.p.j.StringEncodingBenchmark.stringGetBytes                   sample   125785
 363.129 ± 17.674  ns/op
> o.a.l.l.p.j.StringEncodingBenchmark.stringGetBytesCharSet88591       sample   117191
  72.606 ±  2.771  ns/op <- variation 1
> o.a.l.l.p.j.StringEncodingBenchmark.stringGetBytesCharSetShiftJIS    sample   102914
 452.721 ± 21.274  ns/op
> o.a.l.l.p.j.StringEncodingBenchmark.stringGetBytesString88591        sample   181547
  79.653 ±  1.735  ns/op <- variation 2
> o.a.l.l.p.j.StringEncodingBenchmark.stringGetBytesStringShiftJIS     sample   125817
 354.961 ±  4.072  ns/op
> {code}
> *jdk 1.7.0_55 (64 bit Hotspot)*
> {code}
> Benchmark                                                              Mode  Samples
    Score    Error  Units
> o.a.l.l.p.j.StringEncodingBenchmark.customIso8859_1                  sample   148456
   93.248 ±  2.193  ns/op <- custom
> o.a.l.l.p.j.StringEncodingBenchmark.encoderIso8859_1                 sample   176198
  516.731 ± 24.054  ns/op
> o.a.l.l.p.j.StringEncodingBenchmark.stringGetBytes                   sample   121660
  731.530 ± 27.116  ns/op
> o.a.l.l.p.j.StringEncodingBenchmark.stringGetBytesCharSet88591       sample    99636
  234.709 ±  3.234  ns/op <- variation 1
> o.a.l.l.p.j.StringEncodingBenchmark.stringGetBytesCharSetShiftJIS    sample   125754
 1401.008 ± 25.385  ns/op
> o.a.l.l.p.j.StringEncodingBenchmark.stringGetBytesString88591        sample   147124
  316.411 ± 21.454  ns/op <- variation 2
> o.a.l.l.p.j.StringEncodingBenchmark.stringGetBytesStringShiftJIS     sample   114733
  808.315 ± 27.177  ns/op
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message