Can you give a small program that runs 1000x faster in one form compared
with the other?

Currently, if foo is strict, GHC transforms (2) into (1), not the other
way round. In general, transforming (1) into (2) looks hard, because it
means finding the common portions of two expressions.   But I'd be
interested to see cases where you get a lot of performance from such a
transformations.

Simon

| -----Original Message-----
| From: [EMAIL PROTECTED]
[mailto:glasgow-haskell-users-
| [EMAIL PROTECTED] On Behalf Of Serge D. Mechveliani
| Sent: 11 October 2004 12:22
| To: [EMAIL PROTECTED]
| Cc: [EMAIL PROTECTED]
| Subject: -allow-extension-for-bottom
| 
| Dear Haskell implementors,
| 
| Consider the compilation flag  -allow-extension-for-bottom
| 
| which changes the language meaning so that allows to ignore
| the bottom value. For example, the programs
| 
|    (1)   (\ x -> (if p x then  foo (g x)  else  foo (h x)) )
| and
|    (2)   (\ x -> foo ((if p x then  g x  else  h x)) )
| 
| become equivalent, and many program transformations become
| possible.
| I suspect that after compiling and running of a program under
| -allow-extension-for-bottom  the user will discover many helpful
| information about the original program.
| For example, under  -allow-extension-for-bottom  it may run 1000
| times faster, and then, the user finds out what to change to have
| a 1000 times speed-up for the original program for the standard
| Haskell.
| 
| Thus, in my particular practical example, it is evident to me that
| it is better to specify (2). But many similar effects are hard to
| find out without compiling under  -allow-extension-for-bottom.
| 
| Maybe, the compiler could issue the warnings like, say,
| 
|   "Consider factoring `if' in ...   This may improve ... "
| ?
| 
| Copy, please, the answer to  [EMAIL PROTECTED],
| 
| -----------------
| Serge Mechveliani
| [EMAIL PROTECTED]
| 
| 
| 
| 
| _______________________________________________
| Glasgow-haskell-users mailing list
| [EMAIL PROTECTED]
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to