Hugs used in circuit simulations code

Hi all thanks to everyone that reviewed my code. The good news 1. I happy to say that it has become useful enough for me to use it in some matlab type caluculations. includes transient and dc op 2. The simple pivtoing code I added into the DSP Lu appears to be useable for this application. The bad news 1. If you dont use some strategy in simplifying circuits and use the simulator only, it would take a considerable amount of time to converge. A simple 10x10 non linear matrix will take 13 minutes. In a high-end circuit simulator this would have taken less than a second. What is everybodies expereience in speed difference between C and interpreted haskell? I am hoping to achieve at least 10x an equivalent C code. So if a 10x10 matrix takes 1 second for C I want it to take 10seconds for hugs. regards fernan -- http://www.fernski.com

Am Mittwoch 29 Juli 2009 03:32:20 schrieb Fernan Bolando:
What is everybodies expereience in speed difference between C and interpreted haskell?
That depends on what you do, unsurprisingly. But usually it's huge. A factor of several hundred is not uncommon, but 10-100 is the normal range (in my limited experience, I almost always compile).
I am hoping to achieve at least 10x an equivalent C code.
Then you should definitely *not* run interpreted code, but compile it. With compiled code, I usually have a factor of less than 10, mostly 2-4, sometimes even better. But some things take longer in Haskell.
So if a 10x10 matrix takes 1 second for C I want it to take 10seconds for hugs.
Execution speed is not one of hugs' strongest points, so I'd be surprised. I recommend you get a GHC.
regards fernan
Cheers, Daniel

daniel.is.fischer:
Am Mittwoch 29 Juli 2009 03:32:20 schrieb Fernan Bolando:
What is everybodies expereience in speed difference between C and interpreted haskell?
Why are you using hugs? Hugs is slower than GHCi, which is around 30x slower on average than GHC, (measured a couple of years ago). Please use ghc -O2 if you care about performance! -- Don

On Wed, Jul 29, 2009 at 10:54 AM, Daniel
Fischer
Am Mittwoch 29 Juli 2009 03:32:20 schrieb Fernan Bolando:
What is everybodies expereience in speed difference between C and interpreted haskell?
That depends on what you do, unsurprisingly. But usually it's huge. A factor of several hundred is not uncommon, but 10-100 is the normal range (in my limited experience, I almost always compile).
Hi Daniel and other thanks for the feedback the old simulation that took 13mins now only takes 2mins. I included a bunch of tweaking options. Someone needs to have a considerable knowledge in the circuit they are simulating and circuit simulator to be able tweak these. I am not that guy though all the tweak strategy are based on a bunch of papers I have been reading lately and blindly implements them. thanks again for the feedback. The new code is still not very haskelly but its a lot more useful now. http://plan9.bell-labs.com/sources/contrib/fernan/escomma/ -- http://www.fernski.com

On Tue, Jul 28, 2009 at 6:32 PM, Fernan Bolando
Hi all
thanks to everyone that reviewed my code.
The good news 1. I happy to say that it has become useful enough for me to use it in some matlab type caluculations. includes transient and dc op 2. The simple pivtoing code I added into the DSP Lu appears to be useable for this application.
The bad news 1. If you dont use some strategy in simplifying circuits and use the simulator only, it would take a considerable amount of time to converge. A simple 10x10 non linear matrix will take 13 minutes. In a high-end circuit simulator this would have taken less than a second.
What is everybodies expereience in speed difference between C and interpreted haskell? I am hoping to achieve at least 10x an equivalent C code. So if a 10x10 matrix takes 1 second for C I want it to take 10seconds for hugs.
Use GHC's profiler. Figure out why and where the code is slow and then you can do something about it: http://book.realworldhaskell.org/read/profiling-and-optimization.html Jason
participants (4)
-
Daniel Fischer
-
Don Stewart
-
Fernan Bolando
-
Jason Dagit