Ask Your Question
1

speed up execution time of script (Cython or other...)

asked 2013-08-03 10:46:18 +0100

mresimulator gravatar image

updated 2015-01-14 11:41:53 +0100

FrédéricC gravatar image

Hi experts!

I have a TOSHIBA laptop with next specifications:

4x Intel core i3 CPU M350 2.27GHz 3gb RAM

I write a script of Monte Carlo simulation that work fine, but i would speed up it.

How can I speed up the execution time of my algorithm?

I heard about Cython, but I dont know what it is and if that works for my goal (speed up algorithm)

Please explain step by step (im a totaly newby...)

Waiting for your answers.

Thanks a lot.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2013-08-03 12:35:07 +0100

tmonteil gravatar image

Cython is not necessarilly the first optimization to try. It may be worth to ensure first that your algorithm has an good complexity. Also, you can check whether you are using the right types/classes ; for example, if you use Sage real numbers in your simulations, RDF will in general be much faster than using RR. And so on. So, it really depends on the current state of your code, if it is not too long, could you please paste it here ?

edit flag offensive delete link more
1

answered 2013-08-03 12:31:21 +0100

Jesustc gravatar image

Take a look at the last section of this. As it is quoted there, «Premature optimization is the root of all evil». So use the profiler (or put prints in the appropriate places) to find out what parts of your calculation are taking the most, and the we will be able to give you more specific answers. Good luck!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-08-03 10:46:18 +0100

Seen: 1,238 times

Last updated: Aug 03 '13