Refactor Time#xmlschema

And refine uncommon date cases.

# Iteration per second (i/s)

|                            |compare-ruby|built-ruby|
|:---------------------------|-----------:|---------:|
|time.xmlschema              |      5.020M|   14.192M|
|                            |           -|     2.83x|
|utc_time.xmlschema          |      6.454M|   15.331M|
|                            |           -|     2.38x|
|time.xmlschema(6)           |      4.216M|   10.043M|
|                            |           -|     2.38x|
|utc_time.xmlschema(6)       |      5.486M|   10.592M|
|                            |           -|     1.93x|
|time.xmlschema(9)           |      4.294M|   10.340M|
|                            |           -|     2.41x|
|utc_time.xmlschema(9)       |      4.784M|   10.909M|
|                            |           -|     2.28x|
|fraction_sec.xmlschema(10)  |    366.982k|    3.406M|
|                            |           -|     9.28x|
|future_time.xmlschema       |    994.595k|   15.853M|
|                            |           -|    15.94x|
This commit is contained in:
Nobuyoshi Nakada 2024-09-22 12:14:56 +09:00
parent b811a9a097
commit 7be1fafe58
No known key found for this signature in database
GPG key ID: 3582D74E1FEE4465
Notes: git 2024-09-23 06:17:39 +00:00
3 changed files with 81 additions and 49 deletions

View file

@ -14,6 +14,8 @@ prelude: |
end
time = Time.now
utc_time = Time.now.utc
fraction_sec = Time.at(123456789.quo(9999999999)).getlocal("+09:00")
future_time = Time.utc(10000)
benchmark:
- time.xmlschema
- utc_time.xmlschema
@ -21,3 +23,5 @@ benchmark:
- utc_time.xmlschema(6)
- time.xmlschema(9)
- utc_time.xmlschema(9)
- fraction_sec.xmlschema(10)
- future_time.xmlschema