Re[2]: [Haskell] Optimizing locking with MVars

2006-05-03 Thread Bulat Ziganshin
Hello John, Wednesday, May 3, 2006, 2:37:03 AM, you wrote: This reminds me, I wonder if we should have an MVar varient that is _just_ for locking, it would have no separate take and put primitives, just a withLock, enforcing the restriction that the thread that took the lock is the same one

[Haskell] Optimizing locking with MVars

2006-05-02 Thread Bulat Ziganshin
Hello haskell, Main reason of slowness of existing Handle-based I/O in GHC is locking around each operation. it is especially bad for simple char-at-a-time I/O where 99% of time spent on locking and unlocking. To be exact, on my CPU, hPutChar for 100mb file requires 150 seconds, while hGetChar

Re: [Haskell] Optimizing locking with MVars

2006-05-02 Thread John Meacham
On Tue, May 02, 2006 at 12:15:20PM +0400, Bulat Ziganshin wrote: Second, i've developed my own simplified version of this procedure. Here i should say that my library uses MVar () field to hold lock and separate immutable data field with actual data locked: data WithLocking h = WithLocking h