-
Notifications
You must be signed in to change notification settings - Fork 643
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
fromList and exponential compile time #172
Comments
I think this may be to do with the Nat index - no special care is taken for the large unary numbers. I've been putting it off until there is a more general way of changing data structures, but I'll do it soon if it's getting in the way. Still working on the new type checking implementation, which will hopefully improve lots of things. I'll get to this when it's done. Edwin. On 30 Jan 2013, at 14:49, nicolabotta notifications@github.com wrote:
|
Just a bump to say this problem still exists. Tested with
An updated program to reflect syntax changes is: module Main
n : Nat
n = 100
nats : Vect n Nat
nats = fromList [1..n]
main : IO ()
main = putStrLn $ show $ cast n |
Still there with Idris 0.9.14 |
Still seems to be there on 0.9.18 Updated code: module Main
import Data.Vect
n : Nat
n = 800
nats : Vect n Nat
nats = fromList [1..n]
main : IO ()
main = putStrLn $ show n |
But
type checks and compiles in constant time in My understanding is that the current type checking approach requires Idris programs to be written in a "lazy implementation" sort of style. I do not know how to characterize such style precisely but the idea is that if a (pseudo) program
does type check and if
rather than
|
Is still an issue? Update: it still seems like an issue on the latest version of Idris 0.11. |
Ahmad Salim Al-Sibahi notifications@github.com wrote:
Sure, the problem is still there and the absolute compile time have
n user time 100 0m6.640s Also, notice that freezing the definition of 'n':
yields
which seems to be an Idris bug to me. Thanks for looking into this issue! Ciao,
|
@nicolabotta Thanks for the update! |
The following program
executes in constant time in n as one would expect. Compilation, however, takes exponential time:
In fact, at n = 3200, compilation virtually stalls (on my laptop) after having eaten up the whole memory (8GB). Notice that replacing
with
yields constant compile times. Is it possible to construct vectors of natural numbers of length n in at most linear time (in n) ?
The text was updated successfully, but these errors were encountered: