Forums

Numpy and Scipy operations too slow

Hi,

I have an app that does some operations (multiply, sum..) with scipy.sparse matrices and numpy.arrays. On my laptop that part of program takes 1 second to execute, but on pythonanywhere varies from 20 to 40 seconds. Why could that happen? Is there a way to speed up the server?

Where are you running the code? In a console or a scheduled task?

One thing to note is that things will probably always be faster on a computer you have complete control over than they will be in a cloud service, unless you spend a lot of money to rent a computer that's all private to you. For example, an m4.xlarge instance on Amazon, which has 4 CPU cores and 16GB of RAM (pretty normal laptop specs) costs $0.20/hour, which adds up to about $150/month, and that's before you've added any storage. Google Cloud Platform and Azure are in pretty much the same ballpark.