Quantcast

SpecConstr message while compiling

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

SpecConstr message while compiling

Daniel Díaz Casanueva
Hi, cafe!
 
I wrote a program and had the following message while compiling (with -O2):
 
SpecConstr
    Function `addOc{v s6RL} [lid]'
      has four call patterns, but the limit is 3
    Use -fspec-constr-count=n to set the bound
    Use -dppr-debug to see specialisations
 
What it means? Is it bad? It only happens when compiling with -O2.
 
addOc is a local function (defined in a where clause). If it helps, here is the definition:
 
addOc x [] = [(x,1)]
addOc x ((y,n):ys) = if x == y then (y,n+1) : ys
                               else (y,n) : addOc x ys
 
I want to know if there is something wrong or a I don't need to take care about this.
 
Thanks in advance,
Daniel Díaz.

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: SpecConstr message while compiling

Daniel Fischer
On Sunday 23 October 2011, 19:33:55, Daniel Díaz Casanueva wrote:

> Hi, cafe!
>
> I wrote a program and had the following message while compiling (with
> -O2):
>
> SpecConstr
>     Function `addOc{v s6RL} [lid]'
>       has four call patterns, but the limit is 3
>     Use -fspec-constr-count=n to set the bound
>     Use -dppr-debug to see specialisations
>
> What it means? Is it bad? It only happens when compiling with -O2.

It's nothing serious.
It's just a message (that accidentally was output by default in the 7.0.*
series) that the spec-constr pass could have done more specialising, but
the limit forbade it.

More specialising on constructors means

- certainly bigger code
- potentially faster code

but it could also become slower (most likely because of worse cache
locality).

It's not even a warning, just a notification.

>
> addOc is a local function (defined in a where clause). If it helps, here
> is the definition:
>
> addOc x [] = [(x,1)]
> addOc x ((y,n):ys) = if x == y then (y,n+1) : ys
>                                else (y,n) : addOc x ys
>
> I want to know if there is something wrong or a I don't need to take
> care about this.

You need not take care of it, but you can try out and pass
-fspec-constr-count=N
on the command line (here, N = 4 is a good start) to see if the generated
code is faster.

>
> Thanks in advance,
> Daniel Díaz.


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: SpecConstr message while compiling

Daniel Díaz Casanueva
Thank you, good response!
 
Anyway, I'm not specially aware about the speed in that section of the program. The really big work is done in other places. Also, addOc runs in lists of 300~400 as maximum (but only in special inputs, average is under 200), so the time difference can't be improved notoriously, and I won't see changes in performance.
 
But I will follow your pointers when necessary in the future.
On Sun, Oct 23, 2011 at 7:50 PM, Daniel Fischer <[hidden email]> wrote:
On Sunday 23 October 2011, 19:33:55, Daniel Díaz Casanueva wrote:
> Hi, cafe!
>
> I wrote a program and had the following message while compiling (with
> -O2):
>
> SpecConstr
>     Function `addOc{v s6RL} [lid]'
>       has four call patterns, but the limit is 3
>     Use -fspec-constr-count=n to set the bound
>     Use -dppr-debug to see specialisations
>
> What it means? Is it bad? It only happens when compiling with -O2.

It's nothing serious.
It's just a message (that accidentally was output by default in the 7.0.*
series) that the spec-constr pass could have done more specialising, but
the limit forbade it.

More specialising on constructors means

- certainly bigger code
- potentially faster code

but it could also become slower (most likely because of worse cache
locality).

It's not even a warning, just a notification.

>
> addOc is a local function (defined in a where clause). If it helps, here
> is the definition:
>
> addOc x [] = [(x,1)]
> addOc x ((y,n):ys) = if x == y then (y,n+1) : ys
>                                else (y,n) : addOc x ys
>
> I want to know if there is something wrong or a I don't need to take
> care about this.

You need not take care of it, but you can try out and pass
-fspec-constr-count=N
on the command line (here, N = 4 is a good start) to see if the generated
code is faster.

>
> Thanks in advance,
> Daniel Díaz.



_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Loading...