From 0ac43767b7a95b208e4562688f6f74942994652d Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Tue, 9 Dec 2025 14:02:16 +0100 Subject: Speed up the bad case of mvecsReplicate using mvecsWriteLinear --- src/Data/Array/Nested/Mixed.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Array/Nested/Mixed.hs b/src/Data/Array/Nested/Mixed.hs index fc1c108..9f24aba 100644 --- a/src/Data/Array/Nested/Mixed.hs +++ b/src/Data/Array/Nested/Mixed.hs @@ -706,7 +706,7 @@ instance (KnownShX sh', KnownElt a) => KnownElt (Mixed sh' a) where mvecsReplicate sh example = do vecs <- mvecsUnsafeNew sh example - forM_ (shxEnum sh) $ \idx -> mvecsWrite sh idx example vecs + forM_ [0 .. shxSize sh - 1] $ \idx -> mvecsWriteLinear idx example vecs -- this is a slow case, but the alternative, mvecsUnsafeNew with manual -- writing in a loop, leads to every case being as slow return vecs -- cgit v1.2.3-70-g09d2