-
Notifications
You must be signed in to change notification settings - Fork 10
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
Reduce TimedResult objects #63
Conversation
Currently graphql-metrics creates a new `TimedResult` object for every single traced field. This can add a lot of object allocations for large documents which can put more pressure on garbage collection. Since `trace_field` is a hot path, this replaces the `GraphQL::Metrics.time` usage with manual time calculations. The other usages are left since they only occur once per operation execution.
CI was broken due to a deprecated action so I re-did the workflow 🚀 |
@@ -93,10 +93,7 @@ def capture_multiplex_start_time | |||
end | |||
|
|||
def capture_lexing_time | |||
# GraphQL::Query#result fires `lex` before the `execute_multiplex` event, so sometimes | |||
# `pre_context.multiplex_start_time_monotonic` isn't set. | |||
lexing_offset_time = pre_context.multiplex_start_time_monotonic || GraphQL::Metrics.current_time_monotonic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrisbutcher this didn't appear to be used at all? The offset is only needed if time_since_offset
is used, but it's not in either of these two places (only duration
and start_time
are)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 🧹💨
.github/workflows/ruby.yml
Outdated
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
ruby: ['2.7', '3.0', '3.1'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you forget Ruby 3.2 or is there a reason we don't yet test or support it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just forgot, added it thanks
ab549ae
to
a008d72
Compare
Currently graphql-metrics creates a new
TimedResult
object for every single traced field. This can add a lot of object allocations for large documents which can put more pressure on garbage collection.Since
trace_field
is a hot path, this replaces theGraphQL::Metrics.time
usage with manual time calculations. The other usages are left since they only occur once per operation execution.