Query and construct using unboxed closures

These closures can be inlined and cause less indirection. This seems to speed
up affected benchmarks by about a third, which is a decent improvement.

Fixes #8.