You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Steve Lawrence (Jira)" <ji...@apache.org> on 2020/01/07 23:49:00 UTC

[jira] [Created] (DAFFODIL-2268) Optimization: reduce number of DecimalFormat's created for TextNumberParsers

Steve Lawrence created DAFFODIL-2268:
----------------------------------------

             Summary: Optimization: reduce number of DecimalFormat's created for TextNumberParsers
                 Key: DAFFODIL-2268
                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2268
             Project: Daffodil
          Issue Type: Bug
            Reporter: Steve Lawrence


We currently have a TextNumberEv Evalutable that creates a ThreadLocal DecimalFormat. And every single numeric text element will have it's own unique TextNumberEv (and thus DecimalFormat), even if all the text number properties are exactly the same. Most schemas will probably have at most just a handful of unique text number properties so having a unique TextNumberEv and DecimalFormat for every one is wasteful. Instead, we should have some sort of cache so that TextNumberEv's with the same properties can reuse an already created DecimalFormat.

A thing to keep in mind is that DecimalFormat is not thread safe, this this cache must use ThreadLocals or something avoid racey code. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)