The branch was moved to my own fork so I can happily push --force if I need to rework the first commits.
Improve perf of:
* Tests are unaffected by this change. * Zone offset and Gregorian cutover are computed from the DateTime. * They are still copied in instances variables for ease of compatibility with current code. * @ajd need to be preserved for now as DateTime only has millisecond precision, date.rb has arbitrary (although mentioned not expected > ns) (via Rational). * Joda methods are used for year,week,day,hour,min and second (but not fractions since it might be imprecise).
…d on Chronology * In ISOChronology, it is fine, but in GJChronology, it's century + 1. * Still a problem for the year right now with GJChronology (but no test!)
… such "times" * that is earlier than 292 275 054 BC or later than 292 278 993 AD ...
* I so wish millis of DateTime was always 0 and nsec be nanoseconds
…ematic in non-latest joda-time * also, Ruby handles division of a negative in a way not conforming to this usage
* from logic in date.rb (which is way simpler) * tests coming in RubySpec
… directly for now ruby 2.0.0p247 Date.new 924.9 ns/i ± 13.60 ( 1.5%) <=> 1081082 ips jruby: before Date.new 20.72 µs/i ± 0.337 ( 1.6%) <=> 48260 ips jruby: after Date.new 10.61 µs/i ± 0.102 ( 1.0%) <=> 94207 ips jruby: without creation of the DateTime Date.new 7.483 µs/i ± 0.212 ( 2.8%) <=> 133643 ips jruby: without computation of millis from ajd (through Rationals) Date.new 4.980 µs/i ± 0.068 ( 1.4%) <=> 200788 ips * ideal scenario is creating the DateTime from civil parameters directly (year, month, day) and never rely on @ajd, but it means rewriting many methods of Date
* Passes test__iso8601 * ruby 2.0.0p247 Date._iso8601 9.046 µs/i ± 0.053 ( 0.6%) <=> 110548 ips * before Date._iso8601 72.35 µs/i ± 24.68 (34.1%) <=> 13821 ips * after Date._iso8601 5.185 µs/i ± 0.065 ( 1.3%) <=> 192847 ips * Date.iso8601 is twice faster, bottleneck seems now #complete_frags
…ntend to pass those tests * Actually the C code simply allocate the Hash upfront and pass it to sub-matchers, leaving it untouched if nothing matches.
…nstead of generic and throw/catch
* but MRI does it too in d_new_by_frags()! * Takes 21.08µs vs 33.78µs for Date.iso8601("2011-03-08"), might not be worth it and get removed.
* single #max_by instead of #map + #select + #sort_by + #last * simple #count instead of #values_at + #compact * no use in counting if :hour, :min and :sec match for every format * do not bother setting those for simple Dates (not DateTimes) * remove sec = min(sec, 59), this is nonsense!
before Date#strftime("%Y-%m-%d") 5.300 µs/i ± 0.020 ( 0.4%) <=> 188668 ips after Date#strftime("%Y-%m-%d") 3.624 µs/i ± 0.009 ( 0.3%) <=> 275922 ips
* makes some tests fail unfortunately, MRI accepts offset of +24 or -24
* Tokenize exactly as the old one but in a much more proper way * Should handle every edge case, with only a grammar of a dozen lines * Remove massive amount of code from TimeOutputFormatter and RubyDateFormat * Add a helper for composed formats to enhance readability
* the look-ahead part (or a substring) would be captured in the current expression * JFlex 1.4 seems fine
* need ThreadContext, use constructor to pass it * pass all related Date/DateTime tests * more arguments, but casting from Object (long versus Rational) seems bad
ruby 2.0.0p247 dump 8.563 µs/i ± 0.169 ( 2.0%) <=> 116785 ips load 7.091 µs/i ± 0.446 ( 6.3%) <=> 141015 ips reload 16.93 µs/i ± 0.346 ( 2.0%) <=> 59059 ips jruby before with cached ajd dump 5.991 µs/i ± 0.033 ( 0.6%) <=> 166926 ips load 15.55 µs/i ± 1.890 (12.1%) <=> 64275 ips reload 24.53 µs/i ± 0.461 ( 1.9%) <=> 40757 ips jruby before without cached ajd dump 8.306 µs/i ± 1.438 (17.3%) <=> 120389 ips load 15.61 µs/i ± 0.384 ( 2.5%) <=> 64062 ips reload 27.76 µs/i ± 1.315 ( 4.7%) <=> 36014 ips jruby using [@dt, @Of, @sg, @sub_millis] dump 30.56 µs/i ± 0.059 ( 0.2%) <=> 32722 ips load 123.4 µs/i ± 0.482 ( 0.4%) <=> 8099 ips reload 165.6 µs/i ± 4.235 ( 2.6%) <=> 6038 ips jruby using [@dt.getMillis, @Of, @sg, @sub_millis] dump 5.154 µs/i ± 0.044 ( 0.9%) <=> 194039 ips load 10.85 µs/i ± 0.062 ( 0.6%) <=> 92154 ips reload 19.41 µs/i ± 0.082 ( 0.4%) <=> 51505 ips
* take advantage of the fact the default TZ should not change
* avoid some irrelevant assertions * using minitest/exclude by method would exclude way too much
I think your modifications to the tests in the
@atambo Yes, I fear they will indeed get away. There is only one minor additional test. I used that technique to comment uninteresting failing assertions, yet testing other assertions within the same method (since minitest/exclude can only exclude by method I think). Excluding blindly these methods would reduce the coverage too much to my taste. I guess we could copy the passing/interesting assertions to some other suite, but it seems a wrong solution.
What if I merged the test changes in jruby/ruby ?
I fixed Date (and also old Rational) marshaling but not Time.
If you make the test changes to jruby/ruby on the appropriate branch (jruby-ruby_1_9_3 most likely) that is probably an ok way to keep them around. We probably need a better system here, but it is what it is.
Once we're caught up, I can see about merging some of our test changes to MRI proper.