sschepens opened a new pull request, #2995:
URL: https://github.com/apache/parquet-java/pull/2995
### Rationale for this change
`Binary.fromCharSequence` is an order of magnitud slower than
`Binary.fromString` when input is a `String`:
```
Benchmarks.fromCharSequence thrpt 25 5885347.328 ± 186669.738 ops/s
Benchmarks.fromString thrpt 25 71335979.492 ± 8800704.044 ops/s
```
Here is the code for the benchmarks:
```java
public class Benchmarks {
private static final String string =
RandomStringUtils.randomAlphanumeric(100);
@Benchmark
@BenchmarkMode(Mode.Throughput)
public void fromCharSequence(Blackhole blackhole) {
blackhole.consume(Binary.fromCharSequence(string));
}
@Benchmark
@BenchmarkMode(Mode.Throughput)
public void fromString(Blackhole blackhole) {
blackhole.consume(Binary.fromString(string));
}
}
```
### What changes are included in this PR?
Change `AvroWriteSupport.fromAvroString()` to use `Binary.fromString` when
operating with string inputs.
### Are these changes tested?
Current tests should cover the cange
### Are there any user-facing changes?
No
Closes #2994
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]