You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Matt Juntunen (Jira)" <ji...@apache.org> on 2021/07/06 03:29:00 UTC
[jira] [Commented] (TEXT-207) Include DoubleFormats utility from
commons-geometry
[ https://issues.apache.org/jira/browse/TEXT-207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17375171#comment-17375171 ]
Matt Juntunen commented on TEXT-207:
------------------------------------
Added PR: [https://github.com/apache/commons-text/pull/248]. I simplified the API quite a bit and just used {{DoubleFunction<String>}} for the format functions instead of a separate {{DoubleFormat}} interface.
The benchmarks show that {{DoubleFormat}} is in general slightly faster than {{DecimalFormat}}.
||Benchmark||(maxExp)||(minExp)||(size)||Mode||Cnt||Score||Error||Units||
|doubleToString|100|-100|10000|avgt|5|5327103.157|± 59484.165|ns/op|
|decimalFormatEngineering|100|-100|10000|avgt|5|7623550.442|± 467970.473|ns/op|
|decimalFormatPlain|100|-100|10000|avgt|5|7440352.981|± 69927.574|ns/op|
|decimalFormatPlainGrouped|100|-100|10000|avgt|5|7913219.202|± 150656.318|ns/op|
|decimalFormatScientific|100|-100|10000|avgt|5|7319364.462|± 57894.693|ns/op|
|doubleFormatEngineering|100|-100|10000|avgt|5|7244752.382|± 178986.471|ns/op|
|doubleFormatPlain|100|-100|10000|avgt|5|6649716.962|± 97897.504|ns/op|
|doubleFormatPlainGrouped|100|-100|10000|avgt|5|6907835.195|± 86801.050|ns/op|
|doubleFormatScientific|100|-100|10000|avgt|5|7209926.599|± 638461.646|ns/op|
> Include DoubleFormats utility from commons-geometry
> ---------------------------------------------------
>
> Key: TEXT-207
> URL: https://issues.apache.org/jira/browse/TEXT-207
> Project: Commons Text
> Issue Type: New Feature
> Reporter: Matt Juntunen
> Priority: Major
> Time Spent: 50m
> Remaining Estimate: 0h
>
> commons-geometry currently contains a [DoubleFormats|https://github.com/apache/commons-geometry/blob/master/commons-geometry-io-core/src/main/java/org/apache/commons/geometry/io/core/utils/DoubleFormats.java] utility class in the {{commons-geometry-io-core}} module that produces standardized string representations of doubles for use in text-based data formats. It has the following features:
> - It is completely thread-safe.
> - It produces string in scientific, engineering, plain, or mixed (plain or scientific depending on value) formats.
> - Performance is comparable to {{DecimalFormat}} and {{BigDecimal}}.
> As mentioned on the dev mailing list, I believe that this class has broader applicability than just geometric data formats and would be a good fit for commons-text.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)