[cvs-nhc98] Avoid unnecessary trace info for untraced code.

User olaf olaf@sparud.net
Fri, 1 Feb 2002 20:33:49 +0100 (CET)


olaf: Fri Feb  1 20:33:49 CET 2002

Update of /usr/src/master/nhc/src/prelude
In directory hinken:/tmp/cvs-serv9395/src/prelude

Modified Files:
	Makefile 
Log Message:
Avoid unnecessary trace info for untraced code.

Changed combinator ulazySat so that it no longer forces evaluation of the trace so that much of untraced code is actually traced.

Reduces trace size substantially:
Adjoxo from 63 MB to 41 MB; everything reachable according to hat-check.
A trivial test program from 4 KB to 0.5 KB; nearly everything reachable according to hat-check; unreachable part needed by hat-detect.

Reduces runtime for ghc; Adjoxo from 29s to 17s.
However, increases runtime for nhc98; Adjoxo from 31s to 1m 45s.

A time profile exposes the problem for nhc98. The new ulazySat uses a new IORef for every invocation. Especially the IO machinery and the unsafePerformIO calls are very expensive in nhc98. 

Some percentages of Adjoxo:
>>= 5.4%; _mkIOok2 3.4%, _mkIOok3 1.6%, unsafePerformIO 5.3%, readIOArray 2.4%, writeIOArray 2.1%, newIOArray 1.9%, newIORef 1.1%, readIORef 0.5%, writeIORef 0.4%, Ix 12.2%, Array 4.6%; sum of these: 41%
ulazySat itself 4%

I'm still not sure that the new definition of ulazySat doesn't lose necessary trace part. Actually a trace should always be demanded before its value. A little modification of uLazySat however proved, that it is not always evaluated that way. uLazySat always returns the hidden parent when its trace is demanded after its normal value.