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 SourceLine to not create a new instance of Error from String method #40

Merged
merged 1 commit into from
Jan 20, 2022

Conversation

kishoresenji
Copy link
Contributor

@kishoresenji kishoresenji commented Jan 14, 2022

We noticed that ErrorStack() takes a considerable amount of cpu while computing the stack and the time is spent in SourceLine() method returning a New(err). This error is completely ignored in the String() method. The optimization is to give the builtin error instead of Error from an internal method which can be used by the String() method. To keep the backward compatibility, SourceLine() is modified to invoke the internal method sourceLine() and returning an Error.

@kishoresenji
Copy link
Contributor Author

Screen Shot 2022-01-14 at 2 00 44 PM

@ConradIrwin ConradIrwin merged commit ee157bf into go-errors:master Jan 20, 2022
@ConradIrwin
Copy link
Contributor

Thanks @kishoresenji

@ConradIrwin
Copy link
Contributor

I've added you as a collaborator to this repo, thank you for the contribution! Please feel free to send pull requests more :)

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