Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster time decoder #20

Merged
merged 11 commits into from
May 3, 2018
Merged

Faster time decoder #20

merged 11 commits into from
May 3, 2018

Commits on Apr 30, 2018

  1. Added a C implementation of the SimpleDecoder's timestamp decode func…

    …tions when using ruby >= 2.3
    
    - SimpleDecoder::TimestampWithTimeZone::decode
    - SimpleDecoder::TimestampWithoutTimeZone::decode
    remy-cassia-tech authored and larskanis committed Apr 30, 2018
    Configuration menu
    Copy the full SHA
    98610b1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    cb36158 View commit details
    Browse the repository at this point in the history
  3. SimpleDecoder's timestamp decode function return the original string …

    …when the string can't be parsed.
    remy-cassia-tech authored and larskanis committed Apr 30, 2018
    Configuration menu
    Copy the full SHA
    2c26094 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9cf1c29 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    97d8440 View commit details
    Browse the repository at this point in the history
  6. Timestamp decoder:

    - Don't fail when the time is more precise than processed
    - Shorten some expect-series.
    - Change Spaces->Tabs.
    - Add a test case for leap-seconds.
    larskanis committed Apr 30, 2018
    Configuration menu
    Copy the full SHA
    5c87b38 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    2d273d4 View commit details
    Browse the repository at this point in the history
  8. Timestamp-Decoder: Use Time.new on Windows instead of rb_time_timespe…

    …c_new()
    
    Both _mkgmtime() as well as mktime() return errors with certain dates.
    This path is approx. 10 times slower, compared with
    rb_time_timespec_new().
    Its still 10 times faster than the previous RegExp way.
    larskanis committed Apr 30, 2018
    Configuration menu
    Copy the full SHA
    be07045 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    4ba476d View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    450c075 View commit details
    Browse the repository at this point in the history
  11. TextDecoder: better test for timegm() - it's a non-std GNU extension

    Also fall through to the slow path, because it fails on Android (using termux)
    with certain time values otherwise:
    
    Failures:
    
      1) PG::Type derivations PG::SimpleCoder#decode timestamps decodes timestamps with date before 1823
         Failure/Error:
           expect( textdec_timestamp.decode('1822-01-02 23:23:59.123456') ).
            to be_within(0.000001).of( Time.new(1822,01,02, 23, 23, 59.123456) )
    
           expected "1822-01-02 23:23:59.123456" to be within 1.0e-06 of 1822-01-02 23:23:59 +0100, but it could not be treated as a numeric value
         # ./spec/pg/type_spec.rb:125:in `block (5 levels) in <top (required)>'
         # ./spec/helpers.rb:31:in `block in included'
    
      2) PG::Type derivations PG::SimpleCoder#decode timestamps decodes timestamps with date after 2116
         Failure/Error:
           expect( textdec_timestamp.decode('2117-01-02 23:23:59.123456') ).
            to be_within(0.000001).of( Time.new(2117,01,02, 23, 23, 59.123456) )
    
           expected "2117-01-02 23:23:59.123456" to be within 1.0e-06 of 2117-01-02 23:23:59 +0100, but it could not be treated as a numeric value
         # ./spec/pg/type_spec.rb:129:in `block (5 levels) in <top (required)>'
         # ./spec/helpers.rb:31:in `block in included'
    
    Finished in 1 minute 19.47 seconds (files took 1.27 seconds to load)
    386 examples, 2 failures, 1 pending
    larskanis committed Apr 30, 2018
    Configuration menu
    Copy the full SHA
    7aac3ec View commit details
    Browse the repository at this point in the history