Using AI Assistant to identity (and fix) performance bottlenecks - #163
Merged
Conversation
- Add Rake tasks for running benchmarks - Add benchmark scripts for SVG, PNG, HTML, ANSI, and format comparison - Add benchmark_helper.rb for shared setup and result saving - Add benchmark/README.md with usage and baseline results - Update Gemfile.lock with benchmark dependencies - Ignore benchmark/results/ in .gitignore - Remove Ruby 3.0 from CI test matrix
- Introduce run_ips_e2e for full workflow timing (generation + export) - Update all export benchmarks to run both end-to-end and rendering-only modes - Expand README with detailed explanation of benchmark types and output - Clarify benchmark output and add summary messages for each script
Rewrite HTML export to use a single loop and preallocate string capacity, improving speed and memory usage. Remove unnecessary helper classes.
- Refactor path tracing to use integer direction constants and arrays - Remove Edge struct, reduce allocations and intermediate arrays - Build SVG path string directly for each loop, minimizing string ops - Improves rendering speed by 130% and reduces output size - Update benchmark README with new performance results - Add comprehensive SVG export tests covering options and output
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.
This pull request introduces a comprehensive benchmarking suite for the RQRCode library, enabling developers to measure and track performance and memory usage across different QR code export formats. It also updates documentation and tooling to support these new benchmarks and clarifies Ruby version requirements.
Performance Improvements
Key Benchmark Insights
Benchmarking Infrastructure and Usage
benchmark/directory, including scripts for SVG, PNG, HTML, ANSI, and format comparison, as well as a detailedbenchmark/README.mdexplaining usage, metrics, and interpretation of results. Benchmark results are saved as JSON for tracking over time.benchmark_helper.rbto provide shared benchmarking utilities, including methods for running IPS (iterations/sec), memory, and stack profiling, and saving results.Documentation and Developer Experience
AGENTS.mdas a development guide for AI agents, summarizing build/test/lint commands, code style, file structure, dependencies, and commit message conventions.README.mdto reflect the new minimum Ruby version (>= 3.2.0), document benchmark usage, and clarify contribution guidelines.Tooling and Configuration
rqrcode_corein theGemfilefor easier local development.