Repository navigation
feat(profiler): GET /api/profiler/compare for the UI's Compare button - #494
Merged
Merged
Conversation
The released UI (frontend >= 1.27) calls /api/profiler/compare?base=&compare=
and reads functions[].{base,compare,diff}_{excl_wt,excl_mu,ct}; the Go
server had no such route, so the comparison page stayed empty.
Functions of either profile, missing side counts 0, biggest wall-time
change first, limit (default 100, max 1000), totals of both profiles.
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.
Problem
The Profiler UI (since frontend 1.27.0, shipped 1.40.0) has a Compare button on each profile card. Picking two profiles opens
/profiler/compare, which callsGET /api/profiler/compare?base=…&compare=…. The Go server had no such route: the request fell through to the SPA, the UI got HTML instead of JSON, and the comparison table stayed empty.Change
modules/profiler/compare.go— new handler, route inapi.go.{functions: [...], total, base_totals, compare_totals}. Each function row hasfunction,base_/compare_/diff_forexcl_wt(µs),excl_mu(bytes) andct— the fieldsprofile-compare.vuereads.0on the other side.limitdefault 100, max 1000.400on missing params,404on unknown profile./api/profiler/compare+ProfilerCompareTotals.Verification
TestCompare(modules/profiler/compare_test.go): shape, missing side = 0, order, limit, 400/404.go vet ./...clean,go test -count=1 ./...green./api/profiler/compareanswers200 application/json, table shows 4 rows (a()1.0ms→3.0ms +200%,b()gone,c()new,main()).Made with harnsy