From bf00298304d866da1ace4878a46e77e81613284a 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(-) (limited to 'src/Data/Array') diff --git a/src/Data/Array/Nested/Mixed.hs b/src/Data/Array/Nested/Mixed.hs index e08f7aa..54b2a9f 100644 --- a/src/Data/Array/Nested/Mixed.hs +++ b/src/Data/Array/Nested/Mixed.hs @@ -714,7 +714,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