(I know this is probably the most overkilled question but)

I've designed a pretty heavy code/script in python, which yes would have been better implemented in 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 access resources slightly faster, but are there any other stock applications that I can kill on the raspbian image that could aid in a better performance output, e.g. Xorg?

  • 2
    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
    Commented Oct 7, 2014 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
    Commented Oct 7, 2014 at 6:05
  • 3
    keep optimizing. maybe rewrite critical parts using a different algorithm. there's no point tweaking the system.
    – lenik
    Commented Oct 7, 2014 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
    Commented Oct 7, 2014 at 23:10

3 Answers 3


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
    Commented Jul 15, 2015 at 12:09

Apart from optimising code & setting nice values, here's a couple of things which you can do to optimise your RPI for performance:

  • disable some services which you don't need to lessen the load (e.g. bluetooth, wifi, avahi, sound, anything you can)
  • update your python version
  • overclock with arm_freq in config.txt
  • install a small (or big) heatsink to bring the temperatures down - not sure how much this actually helps performance
  • update firmware & kernel (check rpi-update which does both)
  • Turn off HDMI

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

  • 2
    Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here. Commented Oct 7, 2014 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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