ion-java
ion-java copied to clipboard
See if speed of Ion 1.1 binary timestamp serialization can be improved
Note: in my initial prototype I used
secondsScale % 3 != 0 || secondsScale > 9. Comparing these alternatives, I think it's pretty much a wash. In the common case (that the scale matches one of the common precisions) my suggestion always requires two comparisons, but it also has the modulo. Yours varies depending on the actual precision. One comparison if the scale is 0, two if it's 3, and so on. Leaving this comment in case you feel like forming a strong opinion on which one is preferable.
Originally posted by @tgregg in https://github.com/amazon-ion/ion-java/pull/618#discussion_r1376867963
There may be other opportunities for optimization as well.