Closed marsve666 closed 4 years ago
Yes, we could just use the passed map without converting it to lowercase. Then it is the responsibility of the caller to keep have correct case in the map.
Since this will require a breaking change we might as well consider doing more than just removing the lowercase call. Perhaps we can do one of these:
(1) Remove the Serialize
module and the 4 functions in it (serialize/deserialize unit and amount)
(2) Move the functions for serialize/deserialize into the Unit
and Amount
modules and remove the Serialize
mdoule
(3) Keep the Serialize
module and change the implementation only
@marsve666 Seems there are no strong opinions on this so perhaps the simplest way forward is to just keep the Serialize
module the same in order to minimize breaking changes.
Fixed by #49
Each time stringToUnit is called, the string-to-unit map gets rebuilt with a lowercase key. When parsing a lot of propertyvaluesets, it adds up and becomes slow. Possible solution, the caller have responsibility of giving the unit map in with lower case keys.
Slow part