Re: [Haskell-cafe] MD5 performance optimizations

2008-05-21 Thread Andrew Coppin
Woo! Salvatore kindly sent me a Darcs patch, and applying it does indeed make it run faster. Yay! [Note that -fvia-c works just fine for me. It doesn't appear to produce a huge speed difference, but it compiles just fine.] Thanks for the tips, guys! :-D The changes are in the online Darcs

Re: [Haskell-cafe] MD5 performance optimizations

2008-05-21 Thread Salvatore Insalaco
2008/5/21 Andrew Coppin [EMAIL PROTECTED]: Woo! Salvatore kindly sent me a Darcs patch, and applying it does indeed make it run faster. Yay! Hi Andrew, I'm glad that -fvia-c works for you: maybe it's a Mac OS X specific bug? Anyway, did you compile with -fvia-c -optc-O3? I expect

Re: [Haskell-cafe] MD5 performance optimizations, and GHC -via-C producing segfaulting binary

2008-05-20 Thread Don Stewart
Thanks for taking a look at this. kirby81: 2008/5/17 Andrew Coppin [EMAIL PROTECTED]: Hi folks. OK, try this: darcs get http://darcs.orphi.me.uk/MyMD5 cd MyMD5 ghc -O2 --make md5sum md5sum some large filename I've got some time to take a look at the code. It's very nice,

Re: [Haskell-cafe] MD5 performance optimizations

2008-05-20 Thread Andrew Coppin
Don Stewart wrote: Andrew, I hope you look carefully at the suggestions here, and use them to improve the code you were working on. Indeed, this is just the sort of stuff I was hoping to get... [Top marks for spotting the laziness leak in pad BTW! I totally missed that.] While I'm here,

Re: [Haskell-cafe] MD5 performance optimizations

2008-05-20 Thread Don Stewart
andrewcoppin: Don Stewart wrote: Andrew, I hope you look carefully at the suggestions here, and use them to improve the code you were working on. Indeed, this is just the sort of stuff I was hoping to get... [Top marks for spotting the laziness leak in pad BTW! I totally missed that.]

Re: [Haskell-cafe] MD5 performance optimizations, and GHC -via-C producing segfaulting binary

2008-05-20 Thread Salvatore Insalaco
2008/5/20 Don Stewart [EMAIL PROTECTED]: Probably compiling with -fvia-C could help even more, but strangely: [roxas:~/Desktop/test2/MyMD5] kirby% ghc -fvia-C -funbox-strict-fields -O2 --make md5sum.hs [roxas:~/Desktop/test2/MyMD5] kirby% time ./md5sum ../../jboss-4.2.2.GA.zip Segmentation

Re: [Haskell-cafe] MD5 performance optimizations

2008-05-20 Thread Andrew Coppin
Don Stewart wrote: andrewcoppin: While I'm here, can I just clarify *exactly* what -funbox-strict-fields actually does? If in doubt, ask the user's guide: http://www.haskell.org/ghc/docs/latest/html/users_guide/pragmas.html#unpack-pragma ...so making a field strict causes

Re: [Haskell-cafe] MD5?

2007-11-17 Thread Andrew Coppin
Neil Mitchell wrote: Hi The MD5SUM.EXE file I have chokes if you ask it to hash a file in another directory. It will hash from stdin, or from a file in the current directory, but point-blank refuses to hash anything else. Try http://www.cs.york.ac.uk/fp/yhc/dependencies/UnxUtils.zip

Re: [Haskell-cafe] MD5?

2007-11-17 Thread Andrew Coppin
Bulat Ziganshin wrote: Hello Andrew, Saturday, November 17, 2007, 5:45:29 PM, you wrote: wasn't MD5 itself. It's all the datatype conversions. Nowhere in the Haskell libraries can I find any of these functions: I had to write all these myself, by hand, and then check that I got

Re: [Haskell-cafe] MD5?

2007-11-17 Thread Thomas DuBuisson
BTW, while I'm here... I sat down and wrote my own MD5 implementation. How is the performance on this new MD5 routine? It looks like we have gone from just one Haskell MD5 implementation (that I know of) to three in a short period of time. This isn't counting the C bindings, of coarse. Also,

Re: [Haskell-cafe] MD5?

2007-11-17 Thread Andrew Coppin
Thomas DuBuisson wrote: BTW, while I'm here... I sat down and wrote my own MD5 implementation. How is the performance on this new MD5 routine? Ask me *after* I modify it to give the correct answers. ;-) Interesting question: How do you determine when an implementation of something as

Re: [Haskell-cafe] MD5?

2007-11-17 Thread Derek Elkins
On Sat, 2007-11-17 at 16:40 +, Andrew Coppin wrote: Thomas DuBuisson wrote: BTW, while I'm here... I sat down and wrote my own MD5 implementation. How is the performance on this new MD5 routine? Ask me *after* I modify it to give the correct answers. ;-) Interesting

Re: [Haskell-cafe] MD5?

2007-11-17 Thread Don Stewart
bulat.ziganshin: Hello Andrew, Saturday, November 17, 2007, 5:45:29 PM, you wrote: wasn't MD5 itself. It's all the datatype conversions. Nowhere in the Haskell libraries can I find any of these functions: I had to write all these myself, by hand, and then check that I got it's a

Re: [Haskell-cafe] MD5?

2007-11-17 Thread Thomas DuBuisson
On Nov 17, 2007 11:40 AM, Andrew Coppin [EMAIL PROTECTED] wrote: As far as I know, mine is unique in that it's 100% Haskell and requires nothing aside from the libraries shipping with GHC in order to compile. (E.g., I downloaded somebody else's, and it just wouldn't compile. It was looking for

Re: [Haskell-cafe] MD5?

2007-11-09 Thread Andrew Coppin
Don Stewart wrote: andrewcoppin: Speaking of which [yes, I'm going to totally hijack this thread now...], does anybody have a Haskell MD5 hash implementation that goes fast? Start with a fast C version, and translate that into code over ByteStrings. If its not within 2x, call the

Re: [Haskell-cafe] MD5?

2007-11-09 Thread Andrew Coppin
Don Stewart wrote: You might like to test against, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/nano-md5-0.1 which is a strict bytestring openssl binding. Is that likely to work on Windows? Much as I'd love a 100% Haskell implementation [that goes fast], I do also have

Re: [Haskell-cafe] MD5?

2007-11-09 Thread Don Stewart
andrewcoppin: Don Stewart wrote: You might like to test against, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/nano-md5-0.1 which is a strict bytestring openssl binding. Is that likely to work on Windows? Much as I'd love a 100% Haskell implementation [that goes

Re: [Haskell-cafe] MD5?

2007-11-09 Thread Andrew Coppin
Don Stewart wrote: andrewcoppin: Don Stewart wrote: You might like to test against, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/nano-md5-0.1 which is a strict bytestring openssl binding. Is that likely to work on Windows? Much as I'd love a 100% Haskell

Re: [Haskell-cafe] MD5?

2007-11-09 Thread Neil Mitchell
Hi The final alternative is that I just call MD5SUM.EXE from my Haskell program and try to parse the output. But that strikes me as rather messy. Messy, but I don't see any disadvantage to doing it this way - if you can control that the MD5SUM program is installed alongside your code. Of

Re: [Haskell-cafe] MD5?

2007-11-09 Thread Andrew Coppin
Neil Mitchell wrote: Hi The final alternative is that I just call MD5SUM.EXE from my Haskell program and try to parse the output. But that strikes me as rather messy. Messy, but I don't see any disadvantage to doing it this way - if you can control that the MD5SUM program is

Re: [Haskell-cafe] MD5?

2007-11-09 Thread Neil Mitchell
Hi The MD5SUM.EXE file I have chokes if you ask it to hash a file in another directory. It will hash from stdin, or from a file in the current directory, but point-blank refuses to hash anything else. Try http://www.cs.york.ac.uk/fp/yhc/dependencies/UnxUtils.zip - that has an MD5SUM program

Re: [Haskell-cafe] MD5? (was: Haskell performance question)

2007-11-09 Thread Thomas M. DuBuisson
I minor changes, fixing up my chunking function (finally) thus eliminating the space leak. Performance is now under 3x that of C! Yay! Also, nano MD5 benched at 1.15x 'C' (for files small enough for strict ByteStrings to do ok). Get the code: darcs get http://code.haskell.org/~tommd/pureMD5 On

Re: [Haskell-cafe] MD5?

2007-11-09 Thread Stefan O'Rear
On Fri, Nov 09, 2007 at 09:05:58PM +, Andrew Coppin wrote: The MD5SUM.EXE file I have chokes if you ask it to hash a file in another directory. It will hash from stdin, or from a file in the current directory, but point-blank refuses to hash anything else. So I'd have to write my

Re: [Haskell-cafe] MD5? (was: Haskell performance question)

2007-11-08 Thread Thomas M. DuBuisson
Glad you asked! http://sequence.complete.org/node/367 I just posted that last night! Once I get a a community.haskell.org login I will put the code on darcs. The short of it it: 1) The code is still ugly, I haven't been modivated to clean. 2) Manually unrolled, it is ~ 6 times slower than C 3)

Re: [Haskell-cafe] MD5? (was: Haskell performance question)

2007-11-08 Thread Don Stewart
andrewcoppin: Don Stewart wrote: dpiponi: I was getting about 1.5s for the Haskell program and about 0.08s for the C one with the same n=10,000,000. I'm sure we can do better than that! That's the spirit! :-D Speaking of which [yes, I'm going to totally hijack this

Re: [Haskell-cafe] MD5? (was: Haskell performance question)

2007-11-08 Thread Don Stewart
thomas.dubuisson: Glad you asked! http://sequence.complete.org/node/367 I just posted that last night! Once I get a a community.haskell.org login I will put the code on darcs. Cool. I'll look at this. You might like to test against,

Re: [Haskell-cafe] MD5? (was: Haskell performance question)

2007-11-08 Thread Stefan O'Rear
On Thu, Nov 08, 2007 at 06:14:20PM -0500, Thomas M. DuBuisson wrote: Glad you asked! http://sequence.complete.org/node/367 I just posted that last night! Once I get a a community.haskell.org login I will put the code on darcs. The short of it it: 1) The code is still ugly, I haven't