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

add benchmark for readLastLine method #20

Closed
wants to merge 2 commits into from

Conversation

baurine
Copy link
Contributor

@baurine baurine commented Jul 8, 2020

This PR doesn't need to merge. It is just for comparing the benchmark result with the new implementation for readLastLine in PR #19

Comparison:

Old way:
result for the last line of 76:
searchLogSuite.BenchmarkReadLastLine        10000            124423 ns/op
searchLogSuite.BenchmarkReadLastLine        10000            126135 ns/op

result for the last line of 76*2=152:
searchLogSuite.BenchmarkReadLastLine        10000            247836 ns/op
searchLogSuite.BenchmarkReadLastLine        10000            251958 ns/op

New way:
searchLogSuite.BenchmarkReadLastLines      1000000              1892 ns/op
searchLogSuite.BenchmarkReadLastLines      1000000              1920 ns/op

Conclusion: the new implementation is 65x (126135/1920) as fast as the old way when the last line is 76 long.

@baurine baurine marked this pull request as draft July 8, 2020 05:49
@baurine
Copy link
Contributor Author

baurine commented Jul 10, 2020

Close it after PR #19 is merged.

@baurine baurine closed this Jul 10, 2020
@baurine baurine deleted the add-benchmark branch July 10, 2020 14:05
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.

1 participant