You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ultimately removed JsRegExp and RawRegex because they both needed to be converted into RspackRegex.
The structure pub JsRegExp(JsObject) could cache the corresponding native js regex, but in reality, we never utilized it: the instance passed back to js was always a new regex instance. Therefore, I decided to abandon this approach.
I did not use #[napi(object)], opting instead to implement FromNapiValue and ToNapiValue myself, allowing for strict passing of the regex. While our implementation of FromNapiValue is not as good as the one provided by napi-rs, the ToNapiValue implementation is slightly better than the native one with js regex. Overall, the performance will still be lower, but I believe this trade-off is worthwhile. (In fact, this impact can be ignored)
Name Base (2024-11-04 a987332) Current Change
10000_big_production-mode + exec 45.9 s ± 613 ms 46.6 s ± 1.06 s +1.43 %
10000_development-mode + exec 1.84 s ± 17 ms 1.85 s ± 21 ms +0.46 %
10000_development-mode_hmr + exec 645 ms ± 12 ms 649 ms ± 8.2 ms +0.67 %
10000_production-mode + exec 2.4 s ± 19 ms 2.4 s ± 30 ms +0.22 %
arco-pro_development-mode + exec 1.79 s ± 63 ms 1.77 s ± 64 ms -0.86 %
arco-pro_development-mode_hmr + exec 429 ms ± 1.2 ms 333 ms ± 54 ms -22.22 %
arco-pro_production-mode + exec 3.19 s ± 87 ms 196 ms ± 16 ms -93.84 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.27 s ± 50 ms 239 ms ± 4 ms -92.68 %
threejs_development-mode_10x + exec 1.58 s ± 7.7 ms 1.57 s ± 20 ms -0.55 %
threejs_development-mode_10x_hmr + exec 784 ms ± 4.2 ms 781 ms ± 15 ms -0.38 %
threejs_production-mode_10x + exec 4.93 s ± 40 ms 4.94 s ± 17 ms +0.20 %
The benchmark looks very weird in some cases. It's good to merge though ;-). Thanks!
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
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
Related to #8254
I ultimately removed
JsRegExpandRawRegexbecause they both needed to be converted intoRspackRegex.
The structure
pub JsRegExp(JsObject)could cache the corresponding native js regex, but in reality, we never utilized it: the instance passed back to js was always a new regex instance. Therefore, I decided to abandon this approach.
I did not use
#[napi(object)], opting instead to implementFromNapiValueandToNapiValuemyself, allowing for strict passing of the regex. While our implementation ofFromNapiValueis not as good as the one provided bynapi-rs, theToNapiValueimplementation is slightly better than the native one with js regex. Overall, the performance will still be lower, but I believe this trade-off is worthwhile. (In fact, this impact can be ignored)Checklist