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 method to convert timestamp into UTC string #224

Merged
merged 4 commits into from
Dec 20, 2024
Merged

Conversation

vitalyisaev2
Copy link
Member

go test -v -cpu=4 -run=none -bench=. -benchmem benchmark_time_formatting_test.go
goos: linux
goarch: amd64
cpu: 12th Gen Intel(R) Core(TM) i7-12700H
BenchmarkRFC3339StdTime
BenchmarkRFC3339StdTime-4       21237474                52.90 ns/op           32 B/op          1 allocs/op
BenchmarkRFC3339Fasttime
BenchmarkRFC3339Fasttime-4      29752654                39.37 ns/op            0 B/op          0 allocs/op
PASS
ok      command-line-arguments  2.398s

uzhastik
uzhastik previously approved these changes Dec 19, 2024
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.52%. Comparing base (5cd13fc) to head (1d7bffc).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #224      +/-   ##
==========================================
+ Coverage   63.06%   63.52%   +0.45%     
==========================================
  Files         115      116       +1     
  Lines        8034     8149     +115     
==========================================
+ Hits         5067     5177     +110     
- Misses       2626     2631       +5     
  Partials      341      341              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vitalyisaev2 vitalyisaev2 changed the title Use third-party library to convert time.Time to UTC string Faster method to convert timestamp to string Dec 20, 2024
@vitalyisaev2
Copy link
Member Author

Новая имплементация функции, конвертирующей time.Time в UTC-строку, в два раза быстрее функции из стандартной библиотеки:

goos: linux
goarch: amd64
pkg: github.com/ydb-platform/fq-connector-go/app/server/conversion
cpu: 12th Gen Intel(R) Core(TM) i7-12700H
=== RUN   BenchmarkTimestampToStringConverter
BenchmarkTimestampToStringConverter
=== RUN   BenchmarkTimestampToStringConverter/Default
BenchmarkTimestampToStringConverter/Default
BenchmarkTimestampToStringConverter/Default-20           7753850               150.5 ns/op            32 B/op        1 allocs/op
=== RUN   BenchmarkTimestampToStringConverter/Unsafe
BenchmarkTimestampToStringConverter/Unsafe
BenchmarkTimestampToStringConverter/Unsafe-20           14706882                71.30 ns/op           32 B/op        1 allocs/op
PASS
ok      github.com/ydb-platform/fq-connector-go/app/server/conversion   2.484s

@vitalyisaev2 vitalyisaev2 changed the title Faster method to convert timestamp to string Faster method to convert timestamp into UTC string Dec 20, 2024
@vitalyisaev2 vitalyisaev2 merged commit aa6a4e9 into main Dec 20, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants