Skip to content

SOLR-18315: Optimize UTF conversions by using standard Java APIs#4653

Open
psalagnac wants to merge 1 commit into
apache:mainfrom
psalagnac:solr-18315-utf-conversion
Open

SOLR-18315: Optimize UTF conversions by using standard Java APIs#4653
psalagnac wants to merge 1 commit into
apache:mainfrom
psalagnac:solr-18315-utf-conversion

Conversation

@psalagnac

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/SOLR-18315

Description

This replaces class ByteUtils by Java API calls, mostly String constructor and getBytes() method when doing short-length byte[] <-> String conversions, or using CharsetEncoder for longer data.

Tests

I validated the perf improvement with RequestWriters benchmark (note it just measures serialization of update requests, whithout processing the requests).

I get a 8.5x improvement in throughput.

### BASELINE
Benchmark                   (batchSize)   (type)   Mode  Cnt     Score     Error  Units
RequestWriters.writeUpdate           10  javabin  thrpt    5  5660,213 ± 277,626  ops/s
RequestWriters.writeUpdate          100  javabin  thrpt    5   572,390 ±   3,854  ops/s
RequestWriters.writeUpdate         1000  javabin  thrpt    5    57,397 ±   0,270  ops/s
RequestWriters.writeUpdate        10000  javabin  thrpt    5     5,704 ±   0,039  ops/s

### AFTER
Benchmark                   (batchSize)   (type)   Mode  Cnt      Score      Error  Units
RequestWriters.writeUpdate           10  javabin  thrpt    5  49797,001 ± 2110,121  ops/s
RequestWriters.writeUpdate          100  javabin  thrpt    5   5245,920 ±  143,421  ops/s
RequestWriters.writeUpdate         1000  javabin  thrpt    5    514,228 ±   15,048  ops/s
RequestWriters.writeUpdate        10000  javabin  thrpt    5     48,803 ±    0,875  ops/s

public static class BenchState {

@Param({"xml", "binary"})
@Param({"xml", "javabin"})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug fix here? Nice to see the benchmarks get used and therefore finding oversights like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants