first pass at optimization for low-level canvas code