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

Reorder the exception fields to have the data field before the exception field #42

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

ykitamura-mdsol
Copy link
Collaborator

As the title says

It's going to be a little slower but I think it's acceptable

Comparison:
              before:  3125192.9 i/s
               after:  2903105.3 i/s - same-ish: difference falls within error

Comment on lines 79 to +84
exception_fields = {
DATA => param_data,
EXCEPTION => "#{exception.class}: #{exception.message}",
STACK => backtrace
}
exception_fields[DATA] = param_data if param_data
exception_fields.compact!

Choose a reason for hiding this comment

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

since you mentioned performance in the description, what about just the naive approach instead of compact?

exception_fields = {}
exception_fields[DATA] = param_data if param_data
exception_fields[EXCEPTION] = "#{exception.class}: #{exception.message}"
exception_fields[STACK] = backtrace

Choose a reason for hiding this comment

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

Hah, yeah, I was thinking of that or:

        exception_fields = {
          DATA => param_data,
          EXCEPTION => "#{exception.class}: #{exception.message}",
          STACK => backtrace
        }
        exception_fields.delete(DATA) unless param_data

Copy link
Collaborator Author

@ykitamura-mdsol ykitamura-mdsol Sep 20, 2024

Choose a reason for hiding this comment

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

it's slow

Comparison:
              before:  3252707.9 i/s
               after:  3001680.9 i/s - same-ish: difference falls within error
               naive:  2732396.6 i/s - same-ish: difference falls within error

@JordiPolo JordiPolo merged commit 5729743 into master Sep 25, 2024
66 checks passed
@JordiPolo JordiPolo deleted the feature/data_first branch September 25, 2024 22:16
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.

4 participants