Benchmark testing number reading/writing in Java.

Overview

double-reader-writer

Benchmark testing number reading/writing in Java. Relates to FasterXML/jackson-core#577

So far, FastDoubleParser looks useful if the parser results can be verified to be correct. The results for RyuWriter seem more mixed. RyuWriter seems to have a major weak point dealing with whole numbers (int/long) but is faster than JDK for writing random doubles. The Schubfach writer has similar results to RyuWriter but is much better with whole numbers.

Also, seems worthwhile to use newer JDKs regardless of whether that is with JDK read/writing or with the custom implementations.

Azul Java 17.0.2 Old Macbook

Benchmark                               Mode  Cnt       Score      Error  Units
ReaderBenchmark.fastDoubleLongReader   thrpt    5   22858.144 ±  261.718  ops/s
ReaderBenchmark.fastDoubleReader       thrpt    5   24819.875 ±  368.288  ops/s
ReaderBenchmark.jdkDoubleReader        thrpt    5    3854.082 ±   67.203  ops/s
ReaderBenchmark.jdkLongReader          thrpt    5   22811.293 ±  351.590  ops/s
WriterBenchmark.jdkDoubleIntWriter     thrpt    5   26394.304 ± 1779.867  ops/s
WriterBenchmark.jdkDoubleWriter        thrpt    5    3439.019 ±   69.317  ops/s
WriterBenchmark.jdkLongWriter          thrpt    5  109371.088 ± 6345.820  ops/s
WriterBenchmark.ryuDoubleWriter        thrpt    5   10890.341 ±  116.903  ops/s
WriterBenchmark.ryuIntWriter           thrpt    5    7395.981 ±   53.028  ops/s
WriterBenchmark.schubfachDoubleWriter  thrpt    5   12675.343 ±  122.862  ops/s
WriterBenchmark.schubfachIntWriter     thrpt    5   22488.307 ±   78.873  ops/s

Azul Java 8.0.302 Old Macbook

Benchmark                               Mode  Cnt      Score       Error  Units
ReaderBenchmark.fastDoubleFloatReader  thrpt    5  23234.799 ±  7646.048  ops/s
ReaderBenchmark.fastDoubleLongReader   thrpt    5  13285.999 ±  6325.269  ops/s
ReaderBenchmark.fastDoubleReader       thrpt    5  11968.453 ± 17433.848  ops/s
ReaderBenchmark.jdkDoubleReader        thrpt    5   2585.516 ±  1037.001  ops/s
ReaderBenchmark.jdkFloatReader         thrpt    5   5965.517 ±  1139.410  ops/s
ReaderBenchmark.jdkLongReader          thrpt    5   9516.470 ±  9143.042  ops/s
WriterBenchmark.jdkDoubleIntWriter     thrpt    5  10986.540 ± 20767.640  ops/s
WriterBenchmark.jdkDoubleWriter        thrpt    5   1360.805 ±  2993.175  ops/s
WriterBenchmark.jdkLongWriter          thrpt    5  26533.555 ± 36950.402  ops/s
WriterBenchmark.ryuDoubleWriter        thrpt    5   9058.091 ±  3430.143  ops/s
WriterBenchmark.ryuIntWriter           thrpt    5   4543.158 ±  4702.344  ops/s
WriterBenchmark.schubfachDoubleWriter  thrpt    5   8562.764 ±  2854.817  ops/s
WriterBenchmark.schubfachIntWriter     thrpt    5  15234.208 ±  4152.243  ops/s
You might also like...

Java JsonPath implementation

Jayway JsonPath A Java DSL for reading JSON documents. Jayway JsonPath is a Java port of Stefan Goessner JsonPath implementation. News 10 Dec 2020 - R

Jan 4, 2023

A streaming JsonPath processor in Java

JsonSurfer - Let's surf on Json! Why JsonSurfer Streaming No need to deserialize entire json into memory. JsonPath Selectively extract json data by th

Dec 12, 2022

Sawmill is a JSON transformation Java library

Sawmill is a JSON transformation Java library

Update: June 25, 2020 The 2.0 release of Sawmill introduces a breaking change to the GeoIpProcessor to comply with the updated license of the MaxMind

Jan 1, 2023

Genson a fast & modular Java Json library

Genson Genson is a complete json - java conversion library, providing full databinding, streaming and much more. Gensons main strengths? Easy to use

Jan 3, 2023

A reference implementation of a JSON package in Java.

JSON in Java [package org.json] Click here if you just want the latest release jar file. Overview JSON is a light-weight language-independent data int

Jan 6, 2023

Fast JSON parser for java projects

ig-json-parser Fast JSON parser for java projects. Getting started The easiest way to get started is to look at maven-example. For more comprehensive

Dec 26, 2022

Java JsonPath implementation

Jayway JsonPath A Java DSL for reading JSON documents. Jayway JsonPath is a Java port of Stefan Goessner JsonPath implementation. News 10 Dec 2020 - R

Jan 5, 2023

Generate Java types from JSON or JSON Schema and annotates those types for data-binding with Jackson, Gson, etc

jsonschema2pojo jsonschema2pojo generates Java types from JSON Schema (or example JSON) and can annotate those types for data-binding with Jackson 2.x

Jan 5, 2023

A JSON Schema validation implementation in pure Java, which aims for correctness and performance, in that order

Read me first The current version of this project is licensed under both LGPLv3 (or later) and ASL 2.0. The old version (2.0.x) was licensed under LGP

Jan 4, 2023
Comments
  • Add comparison with the Schubfach algorithm

    Add comparison with the Schubfach algorithm

    "The Schubfach way to render doubles" by Raffaello Giulietti: https://drive.google.com/file/d/1luHhyQF9zKlM8yJ1nebU0OgVYhfC6CBN/view

    Sources with the license are here: https://github.com/c4f7fcce9cb06515/Schubfach/blob/3c92d3c9b1fead540616c918cdfef432bca53dfa/todec/src/math/

    opened by plokhotnyuk 3
  • Add comparison for floats/doubles with short mantissas

    Add comparison for floats/doubles with short mantissas

    Ryu does a lot of rounding iterations for floats and doubles with short mantissas. That can lead to 2x slow down comparing serialization of arbitrary values.

    opened by plokhotnyuk 0
Owner
PJ Fanning
Experienced developer with an interest in open source. Member of Apache Software Foundation.
PJ Fanning
Write JSON unit tests in less code. Great for testing REST interfaces.

JSONassert Write JSON unit tests in less code. Great for testing REST interfaces. Summary Write JSON tests as if you are comparing a string. Under the

Skyscreamer 899 Dec 29, 2022
Convert Java to JSON. Convert JSON to Java. Pretty print JSON. Java JSON serializer.

json-io Perfect Java serialization to and from JSON format (available on Maven Central). To include in your project: <dependency> <groupId>com.cedar

John DeRegnaucourt 303 Dec 30, 2022
A Java serialization/deserialization library to convert Java Objects into JSON and back

Gson Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to a

Google 21.7k Jan 8, 2023
A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back

A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back, with a transparent support of any kind of self-references and with a full Java 9 compatibility.

Andrey Mogilev 9 Dec 30, 2021
A simple java JSON deserializer that can convert a JSON into a java object in an easy way

JSavON A simple java JSON deserializer that can convert a JSON into a java object in an easy way. This library also provide a strong object convertion

null 0 Mar 18, 2022
Java with functions is a small java tools and utils library.

Java with functions is a small java tools and utils library.

null 4 Oct 14, 2022
Set of support modules for Java 8 datatypes (Optionals, date/time) and features (parameter names)

Overview This is a multi-module umbrella project for Jackson modules needed to support Java 8 features, especially with Jackson 2.x that only requires

FasterXML, LLC 372 Dec 23, 2022
A modern JSON library for Kotlin and Java.

Moshi Moshi is a modern JSON library for Android and Java. It makes it easy to parse JSON into Java objects: String json = ...; Moshi moshi = new Mos

Square 8.7k Dec 31, 2022
A fast JSON parser/generator for Java.

fastjson Fastjson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON str

Alibaba 25.1k Dec 31, 2022
JSON to JSON transformation library written in Java.

Jolt JSON to JSON transformation library written in Java where the "specification" for the transform is itself a JSON document. Useful For Transformin

Bazaarvoice 1.3k Dec 30, 2022