Skip to content

Implement binary encoding for date and time types #342

Closed

Description

@roji

Discussion started in #335

Activity

  1. added this to the milestone on Sep 14, 2014
  2. self-assigned this
    on Oct 16, 2014
  3. roji commented on Oct 16, 2014

    @roji
    MemberAuthor

    Implemented binary encoding for date only for now, performance increase of about 12%.

  4. franciscojunior commented on Oct 16, 2014

    @franciscojunior
    Member

    That's excellent, @roji !

  5. roji commented on Oct 18, 2014

    @roji
    MemberAuthor

    Binary for time, performance increase of about 16%

  6. Emill commented on Oct 18, 2014

    @Emill
    Contributor

    How do you measure performance?

  7. roji commented on Oct 18, 2014

    @roji
    MemberAuthor

    I added some SpeedTests around Date and Time, which do a tightloop roundtrip test. I run for 60 seconds before and after the change and compare.

    Frankly I'm surprised efficiency isn't improved further, in the case of Postgresql time it's almost a direct translation from DateTime (or more precisely, from TimeSpan) - all you need to do is multiply/divide by ten since Postgresql's resolution is one microsecond and .NET's is 100 nanoseconds...

  8. franciscojunior commented on Oct 18, 2014

    @franciscojunior
    Member

    Frankly I'm surprised efficiency isn't improved further, in the case of Postgresql time it's almost a direct translation from DateTime (or more precisely, from TimeSpan) - all you need to do is multiply/divide by ten since Postgresql's resolution is one microsecond and .NET's is 100 nanoseconds...

    Unless there is something else holding up, maybe the binary encoding hasn't a so much better performance than text after all, or maybe for this particular type there are many other things involved in storing or post processing the value which makes the performance of binary encoding less impacting.

  9. roji commented on Oct 18, 2014

    @roji
    MemberAuthor

    Well, even if it's not 50%, 16% percent for "free" is nice too :)

  10. franciscojunior commented on Oct 18, 2014

    @franciscojunior
    Member

    Well, even if it's not 50%, 16% percent for "free" is nice too :)

    Sure!
    I think it is very nice! 16% is a value which can't be underestimated. :)

  11. roji commented on Oct 18, 2014

    @roji
    MemberAuthor

    One thorny detail: Postgresql can be compiled with 64-bit timestamps (the default) or with a floating-point representation of them; this changes the binary representation entirely. This information is sent at startup-time via the integer_datetimes parameter.

    This would mean an architecture change, as the binary converters (both way) would depend on the connector. Will probably leave this for now, pick up after the performance work in #385 is done.

  12. modified the milestone: on Jan 13, 2015
  13. roji commented on Jan 25, 2015

    @roji
    MemberAuthor

    FYI, pushed commit to check for integer_datetimes and refuse to read/write if it isn't on. Type handlers can now optionally accept their connector to modify behavior based on parameters.

  14. roji commented on Mar 23, 2015

    @roji
    MemberAuthor

    Done, see additional discussion in #347

  15. modified the milestones: , 3.0-beta1 on Mar 30, 2015
  16. modified the milestones: 3.0-beta1, on Aug 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions