Writers Benchmark

Writers Parent POM

License

License

MIT
GroupId

GroupId

com.github.marschall
ArtifactId

ArtifactId

writers-benchmark
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

Writers Benchmark
Writers Parent POM

Download writers-benchmark

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.marschall/writers-benchmark/ -->
<dependency>
    <groupId>com.github.marschall</groupId>
    <artifactId>writers-benchmark</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.marschall/writers-benchmark/
implementation 'com.github.marschall:writers-benchmark:0.2.0'
// https://jarcasting.com/artifacts/com.github.marschall/writers-benchmark/
implementation ("com.github.marschall:writers-benchmark:0.2.0")
'com.github.marschall:writers-benchmark:jar:0.2.0'
<dependency org="com.github.marschall" name="writers-benchmark" rev="0.2.0">
  <artifact name="writers-benchmark" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.marschall', module='writers-benchmark', version='0.2.0')
)
libraryDependencies += "com.github.marschall" % "writers-benchmark" % "0.2.0"
[com.github.marschall/writers-benchmark "0.2.0"]

Dependencies

compile (2)

Group / Artifact Type Version
com.github.marschall : writers jar 0.2.0
org.openjdk.jmh : jmh-core jar 1.25.2

Project Modules

There are no modules declared in this project.

Writers Maven Central Javadocs

Implementations of java.io.Writer with different trade-offs.

java.io.OutputStreamWriter is very flexible and supports any encoding. However its use of sun.nio.cs.StreamEncoder can result in a noticeable overhead for small writes. It allocates a few temporary objects which for small writes can be noticeable. By addressing only special cases we can make optimizations based on different trade-offs.

Currently we only offer the following two classes:

  • com.github.marschall.writers.AsciiOutputStreamWriter, only supports US-ASCII.
    • does not allocate any objects
    • thread-safe
  • com.github.marschall.writers.BufferedAsciiOutputStreamWriter, only supports US-ASCII but also buffers like a java.io.BufferedOutputStream. This can result in more efficient writes than using com.github.marschall.writers.AsciiOutputStreamWriter with java.io.BufferedOutputStream.
    • does not allocate any objects beyond the initial byte[], the #write and #append methods do not allocate memory
    • uses bulk array copy methods on Java 9+
    • not thread-safe

This project requires Java 11.

Versions

Version
0.2.0
0.1.1
0.1.0