fallintoplace opened a new pull request, #2278: URL: https://github.com/apache/iceberg-go/pull/2278
## What Skip general URL parsing for simple local paths in `fileuri.Parse`. ## Why Plain local file paths need no URL decoding. Skipping the general parser removes work and an allocation from this common path. ## Implementation - Fast-path lowercase `file:///` paths with simple ASCII characters. - Keep `net/url.Parse` for escaped, malformed, non-ASCII, query, authority, opaque, and drive-letter forms. - Add URL-equivalence checks and a package benchmark. ## Benchmark `GOMAXPROCS=1 go test ./internal/fileuri -run '^$' -bench '^BenchmarkParseFileURI$' -benchmem -benchtime=220ms -count=7` Go 1.26.3, darwin/arm64, Apple M1 Pro. Seven samples compared with benchstat. Base `a4fb4d0dafaeaf455990c1c3142462107662e5ec`, head `b69908d3497f7eb1aca7bee1a72fd532a7d2e2f4`. The package benchmark measures `Parse`, not end-to-end FileIO. The same benchmark file was used on both revisions. | Case | Base → candidate | B/op | Allocs/op | | --- | ---: | ---: | ---: | | Short local | 183.5 → 16.68 ns/op (11.0×) | 144 → 0 | 1 → 0 | | Warehouse path | 317.4 → 50.71 ns/op (6.3×) | 144 → 0 | 1 → 0 | | Long local | 895.9 → 257.1 ns/op (3.5×) | 144 → 0 | 1 → 0 | | Escaped local | 364.6 → 370.3 ns/op (no significant change) | 224 → 224 | 3 → 3 | | Authority | 230.1 → 201.4 ns/op | 144 → 144 | 1 → 1 | | Windows drive | 208.8 → 205.6 ns/op | 144 → 144 | 1 → 1 | | Opaque | 158.5 → 157.4 ns/op | 144 → 144 | 1 → 1 | Only the simple-local cases use the fast path. Fallback allocation counts are unchanged; no fallback timing gains are claimed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
