chore(controllers): embed gtime to cut build time#2514
Merged
Conversation
Baarsgaard
approved these changes
Feb 17, 2026
Collaborator
Baarsgaard
left a comment
There was a problem hiding this comment.
The binary size also shrinks! 95Mi -> 81Mi
Collaborator
Author
|
@Baarsgaard ah, that's nice! I've completely forgotten to check the binary size, thanks for highlighting that :) |
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.
In #2269, there was the gtime dependency added to parse a wider set of durations. As a consequence, many indirect dependencies were added as well.
When analyzing build time using actiongraph, I've noticed that, on my laptop (8-core M1), all those deps contribute about 30-40 seconds in total, which seems to be too much for just a single function we wanted to use.
To mitigate that, I've prepared a new
gtimepackage that contains only the code related toParseDuration(). - It's mostly a copy of https://github.com/grafana/grafana-plugin-sdk-go/backend/gtime, but decoupled from https://github.com/grafana/grafana-plugin-sdk-go/backend (backend.DownstreamError) and reformatted according to our current linter/formatter settings.Of course, the actual effect depends on many factors, but when I measured the build time with clean cache, it dropped from ~233.177s to ~192.593s.
Build stats
~30.34s (doesn't include linking and waiting).