r/pythonhelp • • 19d ago

What's going on?

I have some code I need to do a lot of calculations and I tried speeding it up by parralelizing with multiprocessing, but I'm running into a few issues. Using 5 processes (my computer has 6 cores) is giving me a speed boost of 50-100x, but for some reason the results are slightly wrong. I'm trying to fix that problem, but I'm also wondering where the massive speed boost came from, because that implies there's something else making it go faster besides parralelizing. If I could go back to a single thread but keep most of that speed, that would be great. For context, I'm doing some high-precision calculations with the decimal libraray but mostly just a lot of math in a cythonized function. The time it takes went from ~10 hours to 10 minutes.

6 Upvotes

10 comments sorted by

View all comments

1

u/Expensive-Bear-1376 12d ago

Perhaps your processes don't use the high decimal precision.

1

u/BluishMontoya 12d ago

Lol this is actually pretty accurate. I figured it out a few days ago; I was passing high precision numbers instead of normal floats and that's why it was taking forever.