Cleanup DateTime.t encoding in RowBinary#315
Merged
ruslandoga merged 4 commits intomasterfrom Apr 20, 2026
Merged
Conversation
DateTime.t encoding in RowBinary
ruslandoga
commented
Apr 20, 2026
| "now" => NaiveDateTime.utc_now() | ||
| "now" => DateTime.utc_now(), | ||
| "now in Tahiti" => DateTime.shift_zone!(DateTime.utc_now(), "Pacific/Tahiti") | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
Operating System: macOS
CPU Information: Apple M2
Number of Available Cores: 8
Available memory: 8 GB
Elixir 1.19.5
Erlang 28.3
JIT enabled: true
Benchmark suite executing with the following configuration:
warmup: 2 s
time: 5 s
memory time: 0 ns
reduction time: 0 ns
parallel: 1
inputs: now, now in Tahiti
Estimated total run time: 28 s
Excluding outliers: false
Benchmarking to_gregorian with input now ...
Benchmarking to_gregorian with input now in Tahiti ...
Benchmarking to_unix with input now ...
Benchmarking to_unix with input now in Tahiti ...
Calculating statistics...
Formatting results...
##### With input now #####
Name ips average deviation median 99th %
to_unix 9.53 M 104.99 ns ±3061.80% 83 ns 208 ns
to_gregorian 8.73 M 114.60 ns ±3495.58% 83 ns 167 ns
Comparison:
to_unix 9.53 M
to_gregorian 8.73 M - 1.09x slower +9.61 ns
##### With input now in Tahiti #####
Name ips average deviation median 99th %
to_unix 9.50 M 105.21 ns ±3040.73% 83 ns 208 ns
to_gregorian 7.49 M 133.60 ns ±5202.71% 125 ns 208 ns
Comparison:
to_unix 9.50 M
to_gregorian 7.49 M - 1.27x slower +28.39 ns
ruslandoga
commented
Apr 20, 2026
| "DateTime64(6) now in Tahiti" => | ||
| {_time_unit = 1_000_000, DateTime.shift_zone!(DateTime.utc_now(), "Pacific/Tahiti")}, | ||
| "DateTime64(9) now in Tahiti" => | ||
| {_time_unit = 1_000_000_000, DateTime.shift_zone!(DateTime.utc_now(), "Pacific/Tahiti")} |
Collaborator
Author
There was a problem hiding this comment.
Operating System: macOS
CPU Information: Apple M2
Number of Available Cores: 8
Available memory: 8 GB
Elixir 1.19.5
Erlang 28.3
JIT enabled: true
Benchmark suite executing with the following configuration:
warmup: 2 s
time: 5 s
memory time: 0 ns
reduction time: 0 ns
parallel: 1
inputs: DateTime64(3) now, DateTime64(3) now in Tahiti, DateTime64(6) now, DateTime64(6) now in Tahiti, DateTime64(9) now, DateTime64(9) now in Tahiti
Estimated total run time: 1 min 24 s
Excluding outliers: false
Benchmarking to_gregorian with input DateTime64(3) now ...
Benchmarking to_gregorian with input DateTime64(3) now in Tahiti ...
Benchmarking to_gregorian with input DateTime64(6) now ...
Benchmarking to_gregorian with input DateTime64(6) now in Tahiti ...
Benchmarking to_gregorian with input DateTime64(9) now ...
Benchmarking to_gregorian with input DateTime64(9) now in Tahiti ...
Benchmarking to_unix with input DateTime64(3) now ...
Benchmarking to_unix with input DateTime64(3) now in Tahiti ...
Benchmarking to_unix with input DateTime64(6) now ...
Benchmarking to_unix with input DateTime64(6) now in Tahiti ...
Benchmarking to_unix with input DateTime64(9) now ...
Benchmarking to_unix with input DateTime64(9) now in Tahiti ...
Calculating statistics...
Formatting results...
##### With input DateTime64(3) now #####
Name ips average deviation median 99th %
to_gregorian 10.05 M 99.55 ns ±5065.62% 83 ns 125 ns
to_unix 7.01 M 142.62 ns ±3745.70% 125 ns 250 ns
Comparison:
to_gregorian 10.05 M
to_unix 7.01 M - 1.43x slower +43.07 ns
##### With input DateTime64(3) now in Tahiti #####
Name ips average deviation median 99th %
to_gregorian 7.29 M 137.24 ns ±5284.51% 125 ns 209 ns
to_unix 7.01 M 142.71 ns ±3873.81% 125 ns 250 ns
Comparison:
to_gregorian 7.29 M
to_unix 7.01 M - 1.04x slower +5.47 ns
##### With input DateTime64(6) now #####
Name ips average deviation median 99th %
to_gregorian 10.16 M 98.40 ns ±4861.36% 83 ns 125 ns
to_unix 7.24 M 138.14 ns ±2746.50% 125 ns 250 ns
Comparison:
to_gregorian 10.16 M
to_unix 7.24 M - 1.40x slower +39.74 ns
##### With input DateTime64(6) now in Tahiti #####
Name ips average deviation median 99th %
to_gregorian 7.28 M 137.27 ns ±4949.95% 125 ns 209 ns
to_unix 7.11 M 140.66 ns ±2833.48% 125 ns 250 ns
Comparison:
to_gregorian 7.28 M
to_unix 7.11 M - 1.02x slower +3.39 ns
##### With input DateTime64(9) now #####
Name ips average deviation median 99th %
to_gregorian 9.03 M 110.70 ns ±3501.29% 84 ns 167 ns
to_unix 7.06 M 141.72 ns ±2605.18% 125 ns 250 ns
Comparison:
to_gregorian 9.03 M
to_unix 7.06 M - 1.28x slower +31.02 ns
##### With input DateTime64(9) now in Tahiti #####
Name ips average deviation median 99th %
to_gregorian 7.03 M 142.28 ns ±2563.82% 125 ns 250 ns
to_unix 6.98 M 143.34 ns ±1095.14% 125 ns 250 ns
Comparison:
to_gregorian 7.03 M
to_unix 6.98 M - 1.01x slower +1.06 ns
Collaborator
Author
There was a problem hiding this comment.
Why is to_gregorian faster?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR also allows non-UTC timezones.