Skip to content

Commit

Permalink
perf(codegen): use iter::repeat_n in CodeBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Feb 24, 2025
1 parent 6764b8d commit 16745b6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/oxc_codegen/src/code_buffer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::iter;

use assert_unchecked::assert_unchecked;

/// A string builder for constructing source code.
Expand Down Expand Up @@ -392,7 +394,7 @@ impl CodeBuffer {
#[cold]
#[inline(never)]
fn write_slow(code_buffer: &mut CodeBuffer, n: usize) {
code_buffer.buf.extend(std::iter::repeat(b'\t').take(n));
code_buffer.buf.extend(iter::repeat_n(b'\t', n));
}

let len = self.len();
Expand Down

0 comments on commit 16745b6

Please sign in to comment.