From b7f47317c2e3ba74fb215a5c859b7a2fbad232d8 Mon Sep 17 00:00:00 2001 From: Doru Date: Fri, 14 Oct 2022 17:17:47 -0300 Subject: [PATCH] Fix quadratic time complexity with large strides (#6727) --- crates/nu-command/src/filters/window.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/nu-command/src/filters/window.rs b/crates/nu-command/src/filters/window.rs index 0480cd246..fa7c02e90 100644 --- a/crates/nu-command/src/filters/window.rs +++ b/crates/nu-command/src/filters/window.rs @@ -215,9 +215,7 @@ impl Iterator for EachWindowIterator { } } - for _ in 0..current_count { - let _ = group.remove(0); - } + group = group[current_count..].to_vec(); } if group.is_empty() || current_count == 0 {