perf(grpc-js): avoid Date allocations on request and channelz tracking paths - #3090
Merged
Merged
Conversation
…g paths Store timestamps as epoch milliseconds (Date.now()) instead of allocating Date objects on the request path and channelz counters: - Call layers (ResolvingCall, RetryingCall, LoadBalancingCall): store call start and resolution times as numbers; construct Date instances only when formatting deadline error messages or when trace logging is enabled. - Channelz call tracker and HTTP/2 transport: record last call started, message sent, and message received timestamps as numbers. - Channel activity tracking: record channel idle timestamp as a number. - Server timeout handling: calculate incoming call deadlines with Date.now() + timeout instead of allocating a Date object. - dateToProtoTimestamp: support numeric millisecond timestamps in addition to Date objects, and use Math.floor() to avoid 32-bit integer overflow beyond year 2038. - formatDateDifference: accept numeric timestamps as well as Date instances. - Update channelz and deadline tests for numeric timestamps.
murgatroid99
approved these changes
Sep 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Store timestamps as epoch milliseconds (Date.now()) instead of allocating Date objects on the request path and channelz counters: