A number of performance tweaks to the typechecking subsystem and a little clean-up in TypeGraph.