Skip to content
  • Jean Boussier's avatar
    57e3fc32
    Move Time#xmlschema in core and optimize it · 57e3fc32
    Jean Boussier authored
    [Feature #20707]
    
    Converting Time into RFC3339 / ISO8601 representation is an significant
    hotspot for applications that serialize data in JSON, XML or other formats.
    
    By moving it into core we can optimize it much further than what `strftime` will
    allow.
    
    ```
    compare-ruby: ruby 3.4.0dev (2024-08-29T13:11:40Z master 6b08a50a) +YJIT [arm64-darwin23]
    built-ruby: ruby 3.4.0dev (2024-08-30T13:17:32Z native-xmlschema 34041ff71f) +YJIT [arm64-darwin23]
    warming up......
    
    |                        |compare-ruby|built-ruby|
    |:-----------------------|-----------:|---------:|
    |time.xmlschema          |      1.087M|    5.190M|
    |                        |           -|     4.78x|
    |utc_time.xmlschema      |      1.464M|    6.848M|
    |                        |           -|     4.68x|
    |time.xmlschema(6)       |    859.960k|    4.646M|
    |                        |           -|     5.40x|
    |utc_time.xmlschema(6)   |      1.080M|    5.917M|
    |                        |           -|     5.48x|
    |time.xmlschema(9)       |    893.909k|    4.668M|
    |                        |           -|     5.22x|
    |utc_time.xmlschema(9)   |      1.056M|    5.707M|
    |                        |           -|     5.40x|
    ```
    57e3fc32
    Move Time#xmlschema in core and optimize it
    Jean Boussier authored
    [Feature #20707]
    
    Converting Time into RFC3339 / ISO8601 representation is an significant
    hotspot for applications that serialize data in JSON, XML or other formats.
    
    By moving it into core we can optimize it much further than what `strftime` will
    allow.
    
    ```
    compare-ruby: ruby 3.4.0dev (2024-08-29T13:11:40Z master 6b08a50a) +YJIT [arm64-darwin23]
    built-ruby: ruby 3.4.0dev (2024-08-30T13:17:32Z native-xmlschema 34041ff71f) +YJIT [arm64-darwin23]
    warming up......
    
    |                        |compare-ruby|built-ruby|
    |:-----------------------|-----------:|---------:|
    |time.xmlschema          |      1.087M|    5.190M|
    |                        |           -|     4.78x|
    |utc_time.xmlschema      |      1.464M|    6.848M|
    |                        |           -|     4.68x|
    |time.xmlschema(6)       |    859.960k|    4.646M|
    |                        |           -|     5.40x|
    |utc_time.xmlschema(6)   |      1.080M|    5.917M|
    |                        |           -|     5.48x|
    |time.xmlschema(9)       |    893.909k|    4.668M|
    |                        |           -|     5.22x|
    |utc_time.xmlschema(9)   |      1.056M|    5.707M|
    |                        |           -|     5.40x|
    ```
Loading