[Haskell-cafe] ACM Task for C++ and Java programmers in Haskell. How to make code faster?

Vasyl Pasternak vasyl.pasternak at gmail.com
Sun Mar 22 18:18:54 EDT 2009


Thanks for the point. I've found haskell solution there
http://www.haskell.org/haskellwiki/Phone_number

The second (shorter) solution is fantastic, it beats all other
languages, but I'll never wrote such code in reasonable time :)

2009/3/22 Bulat Ziganshin <bulat.ziganshin at gmail.com>:
> Hello Vasyl,
>
> Sunday, March 22, 2009, 8:25:02 PM, you wrote:
>
> i believe that i already seen this problem here a few years ago :)
>
> what search structure you was used? i think that immutable hash
> (represented as array of lists) would be useful here
>
>> Hi!
>
>> Recently I've found interesting ACM research on C++ and Java efficiency.
>> This task also was been solved on lisp/scheme and is described on
>> http://www.flownet.com/ron/papers/lisp-java/
>
>> I tried to solve this task on Haskell but stuck with efficiency
>> problems (approx in 1000 times slower and takes 20 times more memory).
>> I hope
>> the approach, I've used is correct and problem with data structures
>> and implementation. It took more than 81% of time for garbage
>> collection. I tried to use ByteStrings instead of Strings, but
>> unfortunately it didn't help.
>
>> The entire code I placed on
>> http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2764
>
>> The original instructions are on:
>> http://www.flownet.com/ron/papers/lisp-java/instructions.html
>
>> Dictionary file could be downloaded from:
>> http://www.flownet.com/ron/papers/lisp-java/dictionary.
>
>> Input data: http://www.flownet.com/ron/papers/lisp-java/input.txt
>
>> Expected output:
>> http://www.flownet.com/ron/papers/lisp-java/output.txt
>
>> Could someone help me to make this code faster? I'd like to see
>> solution that will be elegant and fast, without heavy optimizations,
>> that will make code unreadable. Also, if it possible, prepare the
>> program to support SMP parallelism.
>
>> Very thanks in advance. Hope you'll enjoy this task :)
>
>
>
>
> --
> Best regards,
>  Bulat                            mailto:Bulat.Ziganshin at gmail.com
>
>



-- 
Best regards,
Vasyl Pasternak


More information about the Haskell-Cafe mailing list