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

improve performance of parseDVBTime #51

Merged
merged 1 commit into from
Aug 4, 2023
Merged

Conversation

aler9
Copy link
Contributor

@aler9 aler9 commented Jul 29, 2023

Using time.Date() instead of time.Parse() and fmt.Sprintf() increases performance by 600%. A benchmark has been added in order to prove it.

Before:

cpu: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
BenchmarkDVBTime
BenchmarkDVBTime-12      3604104               334.9 ns/op
PASS
ok      github.com/asticode/go-astits   1.554s

After:

cpu: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
BenchmarkDVBTime
BenchmarkDVBTime-12     22340049                53.35 ns/op
PASS
ok      github.com/asticode/go-astits   1.256s

Using time.Date() instead of time.Parse() and fmt.Sprintf() increases
performance by 600%. A benchmark has been added in order to prove it.
@asticode
Copy link
Owner

asticode commented Aug 4, 2023

Thanks for the PR! ❤️

Let me know whether you need a new tag.

@asticode asticode merged commit d345807 into asticode:master Aug 4, 2023
1 check failed
@aler9 aler9 deleted the patch-time branch August 4, 2023 12:51
This pull request was closed.
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