On Wed, Oct 17, 2012 at 07:00:38PM +0300, Roman Cheplyaka wrote: > * Serge D. Mechveliani <mech...@botik.ru> [2012-10-17 19:37:38+0400] > > But it is generally difficult for me to admit that sometimes it is > > desirable to use strinctess annotation. > > I programmed DoCon for 6 years, and it does not have any bit of > > strictness annotation, and I always had an impression that it is all > > right with performance. > > Yeah, I was also surprised that this is news to you :) > > > And now it occurs that setting $! in some places may make many parts > > of it somewhat 100 times less expensive > > -- ? > > Somehow difficult to admit. > > Laziness is subtle. Sometimes you make an innocent change to a program, > but it changes the time when things are evaluated, and that affects > memory/performance significantly. >
I was always aware of all these effects. I deliberately avoided any strictness annotation. And the whole result has a reasonable performance. But then, I forget it, each time, and start to think "everything is all right". This lasts till the next unlucky example, as the above qRem. And each time I recall of unneeded laziness. And concerning this example: I am not even sure now that it worths to setting $! there. Because I deliberately program qRem as returning a pair (quot, rem), and do not program a separate function for rem. And to obtain rem, one applies snd (qRem n m), and due to laziness, quot does not spend the cost. I do not know, may be, using $! may damage this style. Another objection against strictess annotation is that they make difficult to transform the code at an early stage of compilation. Regards, Sergei _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users