Welcome to Religious Forums, a friendly forum to discuss all religions in a friendly surrounding.
Your voice is missing! You will need to register to get access to the following site features:We hope to see you as a part of our community soon!
I'm working on a project using python. Anyone here good with it?
I'm looking for ways to make functions with lots of loops run faster.
I'm working on a project using python. Anyone here good with it?
I'm looking for ways to make functions with lots of loops run faster.
No worries.Sorry. I just resurrected my perl knowledge (with a lot of google help) but can only read python not program using that language.
I think this is what I'm trying.I don't do python, but one thing that generally helps is to remove redundancy within loops by "hoisting" calculations to higher levels if possible.
Thanks for the advice. I can't use anything other than python and R at the moment. Learning any of the Cs is on the list of future things I might do.Here are some general ideas, each is useful only in certain contexts, not universally:
- create tests to break out of loops early when possible
- if the loops are nested, consider reorganizing the nesting scheme
- make sure your loops aren't doing anything that could be done outside the loops
- use Rust or C
- use short curcuits (if available)
- if you're making new "things" in your loops, find an alternative, like reusing out of scope "things"
Already on it. Cheers.I don't use python and not programmed since i was a babe in arms. I can however suggest you take a look a vectors and see if they'll work.
A Super-Fast Way to Loop in Python
I am barely a programmer, but I have self studied Python 3 and written some code. I recommend The Python Cookbook which will show you a lot about the standard library. You may find both examples of good code there and ways to pass your data to compiled C code or other code. You want loops to run in C, so any standard library function which takes your data and runs it in C code then ports it back into the Python representation is a good thing. Numpy is an exemplary method for processing data in arrays. Python hands a large chunk of data to Numpy, lets Numpy process it, then takes the processed data back from Numpy.I'm working on a project using python. Anyone here good with it?
I'm looking for ways to make functions with lots of loops run faster.
Actually, just scratch out my advice; because no I am not good with it. I have temporarily lost interest and am on one of many other trails. Its a fun language, and its a great general purpose language.I'm working on a project using python. Anyone here good with it?
Perhaps if you described the project better you might get hel
Well, I did try to turn everything into numpy arrays because I read the execute faster than native python loops so it was good advice.Actually, just scratch out my advice; because no I am not good with it.
I'll post some code and I'll describe what I'm doing later on tonight or tomorrow. Thanks.I mostly programmed in other languages but I taught two Python classes. Perhaps if you described the project better you might get hel