[threeten-dev] Minor performance tuning for LocalDate.of(int, int, int)

Xueming Shen xueming.shen at oracle.com
Wed Mar 6 15:46:37 PST 2013


(1) LocalDate.of(int, int, int)
      appears to create a use-and-throw "Month" object for validation purse
      only,  it can be "saved" with a hard-coded Month.length, something worth
      doing? given we are talking about "immutable" LD date type and assume
      new objects would be frequently "created" instead of "mutated".

(2) LocalDate.ofYearDay(int, int)
      LocalDate.resolvePreviousValid(int, int, int)
     Shouldn't they just call new LocalDate(year, month, day)?
     all fields have been validated already, it is unnecessary to go
     of()->create()-> new LocalDate()

Here is the proposed update, opinion?

http://cr.openjdk.java.net/~sherman/jdk8_threeten/ldPerm/

-Sherman




More information about the threeten-dev mailing list