various optimizations, mostly by bypassing things when their parameters are below a threshold