(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?
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
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.