Ask Your Question

How to speed up running SageMath programs

asked 2016-08-19 06:03:14 -0500

Erel Segal-Halevi gravatar image

I am writing a SageMath program that I want to run from within the editor (I use Atom editor, with a plugin that enables me to run sage). Whenever I run a script, it takes about 1.5 seconds, even if the script only writes "hello world". In contrast, when I run the same script using Python, it takes only 0.04 seconds.

is there a way to run SageMath scripts faster?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-08-19 06:12:52 -0500

B r u n o gravatar image

A possible reason could be that your plugin starts (a new session of) SageMath each time you run the script. And SageMath is very long to start (1 to 2 seconds on my laptop). Actually, this happens for instance if you invoke sage myscript.sage in a terminal: It takes ~1s + the time for the script to execute.

edit flag offensive delete link more


Yes, Sage loads a vast number of libraries each time it starts. Maybe forking processes or parallelism is the way to go?

kcrisman gravatar imagekcrisman ( 2016-08-19 08:47:18 -0500 )edit

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


Asked: 2016-08-19 06:03:14 -0500

Seen: 86 times

Last updated: Aug 19 '16