There are many things that can affect the speed at which drawing is achieved on your computer. These include, but are probably not limited to; your graphics card, CPU, operating system, running programs, stimuli, and your code itself. Of these, the CPU and the OS appear to make rather little difference. To determine whether you are actually dropping frames see Detecting dropped frames.
make sure you have a good graphics card. Avoid integrated graphics chips, especially Intel integrated chips and especially on laptops (because on these you don’t get to change your mind so easily later). In particular, try to make sure that your card supports OpenGL 2.0
anti-virus auto-updating (if you’re allowed)
email checking software
file indexing software
backup solutions (e.g. TimeMachine)
run in full-screen mode (rather than simply filling the screen with your window). This way the OS doesn’t have to spend time working out what application is currently getting keyboard/mouse events.
don’t generate your stimuli when you need them. Generate them in advance and then just modify them later with the methods like setContrast(), setOrientation() etc…
if you don’t have OpenGL 2.0 then calls to setContrast, setRGB and setOpacity will also be slow, because they also make a call to setTexture(). If you have shader support then this call is not necessary and a large speed increase will result.
if you need to create a large number (e.g. greater than 10) similar stimuli, then try the ElementArrayStim (currently not supported for online experiments)
It isn’t clear that these actually make a difference, but they might).
disconnect the internet cable (to prevent programs performing auto-updates?)
on Macs you can actually shut down the Finder. It might help. See Alex Holcombe’s timing tips page
use a single screen rather than two (probably there is some graphics card overhead in managing double the number of pixels?)