diff options
| author | Mikolaj Konarski <mikolaj.konarski@funktory.com> | 2025-12-09 14:02:16 +0100 |
|---|---|---|
| committer | Mikolaj Konarski <mikolaj.konarski@funktory.com> | 2025-12-09 14:02:16 +0100 |
| commit | 0ac43767b7a95b208e4562688f6f74942994652d (patch) | |
| tree | 6681237c2a846a9a1325f0a74ff92117cb68e1cf | |
| parent | ab020a0ece9383f04412964b9fc09d17874d3383 (diff) | |
Speed up the bad case of mvecsReplicate using mvecsWriteLinear
| -rw-r--r-- | src/Data/Array/Nested/Mixed.hs | 2 |
1 files changed, 1 insertions, 1 deletions
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 |
