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

Use caller_locations to reduce memory allocation #138

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

fatkodima
Copy link
Contributor

Closes #137.
Added original author as a coauthor.

cc @byroot

@byroot byroot merged commit 226f932 into basecamp:master Jan 10, 2024
12 checks passed
@fatkodima fatkodima deleted the caller-locations branch January 10, 2024 21:42
@fatkodima
Copy link
Contributor Author

Thank you! ❤️ 🎉

@@ -112,10 +112,12 @@ def self.sidekiq_job
def self.line
Marginalia::Comment.lines_to_ignore ||= DEFAULT_LINES_TO_IGNORE_REGEX

last_line = caller.detect do |line|
line !~ Marginalia::Comment.lines_to_ignore
last_line = caller_locations.detect do |loc|

Choose a reason for hiding this comment

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

@fatkodima before I dive into it... did you ever look at using Thread.each_caller_location in this gem? I know you did in Rails but not sure if there was a reason to not do it here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did you ever look at using Thread.each_caller_location in this gem?

I think I don't.

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.

3 participants