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

The . operator degrades compile time exponentially #717

Closed
amieres opened this Issue Jul 19, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@amieres

amieres commented Jul 19, 2017

I ran some benchmarks of this simple code on my computer and on Try.WebSharper.com.
Every added call to .Before doubles the time it takes to compile (not execute).
If [< WebSharper.JavaScript >] is removed compilation is really fast as expected.

[< WebSharper.JavaScript >]
module b =

    type Simple = {  before : bool }
    with
        static member New  = {           before = false }
        member this.Before = { this with before = true  }
    
    Simple.New
        .Before.Before.Before.Before.Before.Before
        .Before.Before.Before.Before.Before.Before  // < 10 seconds    // try.websharper.com
        .Before.Before.Before.Before.Before.Before  //   10 seconds    //  14
        .Before.Before                              //   25 seconds    //  39
        .Before                                     //   44 seconds    //  70
        .Before                                     //   86 seconds    // 155 seconds
        //.Before                                     //  164 seconds
        //.Before                                     //  322 seconds
    |> printfn "%A"
@Jand42

This comment has been minimized.

Show comment
Hide comment
@Jand42

Jand42 Jul 19, 2017

Member

@amieres Thanks for the report!

This was indeed a bad mistake, the this argument of calls were translated twice unnecessarily, blowing up compilation time on long chains of method/property calls.

Releasing the fix soon.

Member

Jand42 commented Jul 19, 2017

@amieres Thanks for the report!

This was indeed a bad mistake, the this argument of calls were translated twice unnecessarily, blowing up compilation time on long chains of method/property calls.

Releasing the fix soon.

@amieres

This comment has been minimized.

Show comment
Hide comment
@amieres

amieres Jul 19, 2017

Good job!

amieres commented Jul 19, 2017

Good job!

@amieres amieres closed this Jul 19, 2017

@Jand42

This comment has been minimized.

Show comment
Hide comment
@Jand42

Jand42 Jul 20, 2017

Member

released in Zafir.4.0.171.72-beta8

Member

Jand42 commented Jul 20, 2017

released in Zafir.4.0.171.72-beta8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment