perf(rust/renamer): new deconflict strategy#1461
Conversation
chore: 🤖 update snap chore: 🤖 clean chore: 🤖 lint chore: 🤖 revert
chore: 🤖 lint chore: 🤖 clean chore: 🤖 try chore: 🤖 update chore: 🤖 cleran chore: 🤖 clean chore: 🤖 clean
✅ Deploy Preview for rolldown-rs canceled.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1461 +/- ##
==========================================
+ Coverage 85.98% 85.99% +0.01%
==========================================
Files 152 152
Lines 7741 7747 +6
==========================================
+ Hits 6656 6662 +6
Misses 1085 1085 ☔ View full report in Codecov by Sentry. |
Benchmarks Rust |
chore: 🤖 update comments chore: 🤖 improve comments
02bac33 to
7376db9
Compare
| let next_conflict_index = *occ.get() + 1; | ||
| *occ.get_mut() = next_conflict_index; | ||
| candidate_name = | ||
| Cow::Owned(format!("{candidate_name}${next_conflict_index}",).into()); |
There was a problem hiding this comment.
| Cow::Owned(format!("{candidate_name}${next_conflict_index}",).into()); | |
| Cow::Owned(format!("{original_name}${next_conflict_index}",).into()); |
| count += 1; | ||
| candidate_name = Cow::Owned(format!("{original_name}${count}").into()); | ||
| loop { | ||
| match self.used_canonical_names.entry(candidate_name.clone()) { |
There was a problem hiding this comment.
| match self.used_canonical_names.entry(candidate_name.clone()) { | |
| match self.used_canonical_names.entry(original_name.clone()) { |
Should you use original_name name here?
There was a problem hiding this comment.
We should use candidate name here, you could ref the algorithm https://github.com/rolldown/rolldown/pull/1461/files#diff-c87caec33470b59eac43cd6ac05bef999e6a4fa010e716fd3e546971148f01d2R15,
There was a problem hiding this comment.
We need to find a fixed point
There was a problem hiding this comment.
If there's is another a, in the current algorithm, will it be renamed to a$1$1$1? If so, I would like to see if we could fix this, it's kind of ugly in the output.
If we don't care the how output looks, we could follow how parcel did which is renaming the vars to a meaningless hashed value. This way it should be more faster.
There was a problem hiding this comment.
We can't use original_name here, it will lead a dead loop, you could see the case in https://github.com/rolldown/rolldown/pull/1461/files#diff-c87caec33470b59eac43cd6ac05bef999e6a4fa010e716fd3e546971148f01d2R15
|
|
||
| //#region shared.js | ||
| const a$2 = 'shared.js'; | ||
| const a$1$1 = 'shared.js'; |
There was a problem hiding this comment.
Alright, I get you, let me test if performance got regressed
Description