0

(I know this is probably the most overkilled question but) I've designed a pretty heavy code/script in python, which yes would of been better implemented on c, but in saying that short of over clocking I would rather prefer to allow as much memory for the actual code to access as possible, I know I can kill startx which makes my code slightly faster access resources, but are there any other stock applications that I can kill on the raspbian image that could aid in a better performance output eg Xorg?

  • You should concentrate on optimizing your script instead of thinking about killing other programs, because well written python programs can run at almost the same speed as C/C++ code, and sometimes even faster. – lenik Oct 7 '14 at 5:28
  • Yeah ive optimised the code left right and centre, and its running a lot better but i just want to see where else i can improve – Pariah Oct 7 '14 at 6:05
  • 2
    keep optimizing. maybe rewrite critical parts using a different algorithm. there's no point tweaking the system. – lenik Oct 7 '14 at 13:55
  • Well I've pretty much optimised the code as much as humanly possible, could you recommend a compiler because i was about to try to use pyinstaller – Pariah Oct 7 '14 at 23:10
2

Assuming you have a piece of code that does some processing, and you want it to process more within a given time frame there are certainly things you can do.

1) The most important thing is, of course, to write your code correctly. You say you have optimized the code as much as possible, but try to get a pair of fresh eyes on it. If you don't have a performance expert within reach, you can probably find some here: https://codereview.stackexchange.com/

2) Make sure your machine isn't busy doing something else. Research the command top. Programs you don't want running on your machine, ever, you could remove using (generally) sudo apt-get remove <program>. If you need more memory, specifically, you can sort the top-list with the interactive command M.

3) Give higher priority to you process. Research nice. Be careful not to starve your own process, tough - that is, if your program consumes data provided by another program, and your process has much higher priority, data might not be available in the pace it can me processed.

4) And the obvious answer: get another machine. The pi is not really made to be a fast cruncher - it's a lab board. If you need to get something done quickly, it's simply not the right HW.

  • Thanks for the info and sorry about the late reply. I did make my code as efficient as humanly possible but i do now fully understand the limitations of using the pi board as it is more of a lab enviroment. – Pariah Jul 15 '15 at 12:09
-2

if you only want your thing to work a great thing to do is compile the python vm as a lklm

  • 1
    Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here. – Steve Robillard Oct 7 '14 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.