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

optimize the readLastLines function for huge lines #25

Merged
merged 3 commits into from
Nov 30, 2020

Conversation

crazycs520
Copy link
Collaborator

image

When the last line is very huge, the readLastLines may be very slow.

Here is a benchmark when the last log line size is 10MB:

Before this PR:
searchLogSuite.BenchmarkReadLastLinesOfHugeLine          1        10227299446 ns/op

This PR:
searchLogSuite.BenchmarkReadLastLinesOfHugeLine        100          14824774 ns/op

Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Copy link
Contributor

@lonng lonng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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