test: Add comprehensive benchmarks and go.mod for easier testing#21
Draft
pedro-stanaka wants to merge 1 commit intogo-sourcemap:masterfrom
Draft
test: Add comprehensive benchmarks and go.mod for easier testing#21pedro-stanaka wants to merge 1 commit intogo-sourcemap:masterfrom
pedro-stanaka wants to merge 1 commit intogo-sourcemap:masterfrom
Conversation
Add benchmarks to measure performance across various sourcemap sizes: - bench_synthetic_test.go: Synthetic sourcemaps from 5KB to 10MB - bench_large_test.go: Real-world sourcemaps (jQuery, Angular, etc.) - Updated Makefile with benchmark targets - Added go.mod to enable module-aware testing The go.mod file makes it easier to run tests and benchmarks without complex GOPATH setup, improving the developer experience. Benchmark targets: - make bench: Run all benchmarks - make bench-mem: Profile memory usage - make bench-cpu: Profile CPU usage - make bench-compare: Compare performance before/after changes
Member
AFAIR the problem is that we already have v2.x version and adding go.mod will require updating imports to We could remove all the v2.x tags, but that's probably even worse... |
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.
Summary
This PR adds comprehensive benchmarks to measure sourcemap parsing performance across various file sizes and scenarios.
What's Added
1. Go Module Support (
go.mod)go.modfile to enable module-aware builds2. Synthetic Benchmarks (
bench_synthetic_test.go)3. Real-World Benchmarks (
bench_large_test.go)4. Enhanced Makefile
New targets for performance analysis:
Sample Output
Rationale for go.mod
While testing these benchmarks, I found it quite difficult to run tests without Go module support:
Adding a minimal
go.modfile solves these issues while maintaining backward compatibility for users who prefer GOPATH mode.Why Benchmarks Matter
Having comprehensive benchmarks allows:
Testing
The benchmarks work with the existing test infrastructure:
Notes
/tmpto avoid repeated downloads*_test.gofiles and don't affect the library sizego test)This provides a foundation for tracking and improving parsing performance over time.