From 28f2e9f19ab4dca24f342b00d0bb2eccf97e5c2d Mon Sep 17 00:00:00 2001 From: Ryan Jones-Ward Date: Tue, 4 Feb 2025 14:26:09 +0000 Subject: [PATCH] Initialise a line to the original length of the line to reduce allocations. --- redox-core/src/parsing/asm_parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redox-core/src/parsing/asm_parser.rs b/redox-core/src/parsing/asm_parser.rs index 9a0d2e6..d3bcd88 100644 --- a/redox-core/src/parsing/asm_parser.rs +++ b/redox-core/src/parsing/asm_parser.rs @@ -402,7 +402,7 @@ impl<'a> AsmParser<'a> { let mut in_quoted_string = false; let mut escaped_args = vec![]; - let mut buffer = String::new(); + let mut buffer = String::with_capacity(graphemes.len()); for (i, g) in graphemes.iter().enumerate() { let is_escaped = i > 0 && graphemes[i - 1] == "\\";