Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: perf bug for large replace source #156

Merged
merged 8 commits into from
Feb 11, 2025

Conversation

SyMind
Copy link
Member

@SyMind SyMind commented Feb 10, 2025

Fix web-infra-dev/rspack#9137

In Rspack's source code, the check_content_at_position function is used to check whether the sourceContent in the source map matches the original source code. If they match, additional mapping information can be added.

The check_content_at_position function uses column (character index) to extract substrings from sourceContent. Since column is a character index and strings are stored as byte indices, a conversion from byte index to character index is required. This conversion process has become a performance bottleneck.

By caching the conversion results from byte index to character index, redundant calculations are avoided, thereby improving performance.

Copy link

codspeed-hq bot commented Feb 10, 2025

CodSpeed Performance Report

Merging #156 will not alter performance

Comparing SyMind:fix-perf-bug (4649d2a) with main (09aa874)

Summary

✅ 6 untouched benchmarks
🆕 1 new benchmarks
⁉️ 1 dropped benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 complex_replace_source N/A 60 ms N/A
⁉️ replace_large_minified_source 118.6 ms N/A N/A

@SyMind SyMind marked this pull request as ready for review February 10, 2025 13:18
@ahabhgk ahabhgk merged commit f15f007 into web-infra-dev:main Feb 11, 2025
6 of 7 checks passed
@SyMind SyMind deleted the fix-perf-bug branch February 11, 2025 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: devtool extremely slow with @remixicon/react
2 participants