Improve transform performance

Calling closures directly rather than through `call_user_func` seems to
have better performance. Other "callable" types are still run the same
way.