Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ performance ] (>>=) and (<*>) for List have quadratic runtime complexity. #2288

Closed
stefan-hoeck opened this issue Jan 25, 2022 · 1 comment

Comments

@stefan-hoeck
Copy link
Contributor

Steps to Reproduce

Build and run the following program:

import Data.SnocList

replicateTR : Nat -> a -> List a
replicateTR n v = go n Nil
  where go : Nat -> List a -> List a
        go 0     xs = xs
        go (S k) xs = go k (v :: xs)

main : IO ()
main = printLn . length $ [1..5000] >>= (\n => replicateTR n n)

Expected Behavior

Runs in a few seconds on reasonably modern hardware.

Observed Behavior

Still not done while I write this issue... But I'll submit a PR with a fix soonish.

@gallais
Copy link
Member

gallais commented Jan 28, 2022

Fixed by #2289

@gallais gallais closed this as completed Jan 28, 2022
@gallais gallais added the status: confirmed bug Something isn't working label Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants