New GHC fails to specialize imported function

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

New GHC fails to specialize imported function

Will Yager
Hello all, 

I just installed the new Haskell platform for OS X.

It seems to have caused a major performance regression for a program I'm working on, making it well over 25x slower.

The culprit appears to be that the new GHC (7.10.2) fails to specialize an imported function. If I manually add a SPECIALIZE pragma, performance goes back to around what it used to be. 

The code in question is located at https://github.com/wyager/HNet .

As it stands, the code takes about 30 seconds to run on my machine. With the previous haskell-platform, it only took about .9 seconds. 

If I modify Operations.hs and uncomment the SPECIALIZE pragma, runtime goes down to about 1.1 seconds (still slower for some reason, but not awful).

To test, compile with -O2 (as the program makes heavy use of Data.Vector, which requires -fspec-constr for performance).



Additionally, my experience doesn't seem to match https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_guide/pragmas.html#specialize-pragma in that if I add an INLINABLE pragma at the site of (••)'s definition and then try to SPECIALIZE it in a different file after importing, GHC tells me "Warning: SPECIALISE pragma on INLINE function probably won't fire: ‘••’". 

Cheers,
Will

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: New GHC fails to specialize imported function

Richard Eisenberg-2
This sounds terrible. Please post a bug report at https://ghc.haskell.org/trac/ghc/wiki/ReportABug

Thanks!
Richard

On Jul 30, 2015, at 11:12 PM, William Yager <[hidden email]> wrote:

Hello all, 

I just installed the new Haskell platform for OS X.

It seems to have caused a major performance regression for a program I'm working on, making it well over 25x slower.

The culprit appears to be that the new GHC (7.10.2) fails to specialize an imported function. If I manually add a SPECIALIZE pragma, performance goes back to around what it used to be. 

The code in question is located at https://github.com/wyager/HNet .

As it stands, the code takes about 30 seconds to run on my machine. With the previous haskell-platform, it only took about .9 seconds. 

If I modify Operations.hs and uncomment the SPECIALIZE pragma, runtime goes down to about 1.1 seconds (still slower for some reason, but not awful).

To test, compile with -O2 (as the program makes heavy use of Data.Vector, which requires -fspec-constr for performance).



Additionally, my experience doesn't seem to match https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_guide/pragmas.html#specialize-pragma in that if I add an INLINABLE pragma at the site of (••)'s definition and then try to SPECIALIZE it in a different file after importing, GHC tells me "Warning: SPECIALISE pragma on INLINE function probably won't fire: ‘••’". 

Cheers,
Will
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe