[threeten-dev] Ser performance
Stephen Colebourne
scolebourne at joda.org
Fri Mar 8 02:02:26 PST 2013
On 8 March 2013 05:10, Xueming Shen <xueming.shen at oracle.com> wrote:
> However I noticed that the ZDT reading/de-serialization time is kinda
> "unproportional"
> bigger, given it only has a LDT, a ZoneOffset and ZoneId to read in. It
> appears we "spend"
> most of the ZoneRegion.ofId() time on the name validation via the regex. the
> regex's
> matches() is too slow for this "simple" validation, unfortunately. Though I
> hate to propose,
> as the proud maintainer of jdk regex:-), but I think it might worth
> considering the simple
> char by char direct match, as we did in java.nio.Charset for the similar
> name validation
> situation, as showed in the following webrev.
>
> http://cr.openjdk.java.net/~sherman/jdk8_threeten/zidPerm/
I'm happy with the principle of the change. I think it might be
cleaner to read and faster if you checked the first character, then
checked the remaining characters. This is safe as the string is at
least length 2.
You should also delete the pattern rather than just commenting it out.
I'd also prefer the checkName() method to be located after ofId(), not
before, in the source file.
thanks
Stephen
More information about the threeten-dev
mailing list