Skip to content

Commit 4515818

Browse files
committed
perf: update the last searched chunk in split_at
1 parent 375d9c2 commit 4515818

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/magic_string/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ impl<'text> MagicString<'text> {
240240
let second_half_idx = self.chunks.push(second_half_chunk);
241241
let first_half_idx = candidate_idx;
242242

243+
// Update the last searched chunk
244+
self.last_searched_chunk_idx = first_half_idx;
245+
243246
// Update the chunk_by_start/end maps
244247
self.chunk_by_end.insert(at_index, first_half_idx);
245248
self.chunk_by_start.insert(at_index, second_half_idx);

0 commit comments

Comments
 (0)