More perf tweaks

- Use H5Pset_create_intermediate_group to create intermediate groups,
  instead of doing this ourselves.
- Store small datasets in compact format.
- Avoid looking up created datasets to create references to them.

Also implement a few more libhdf5 functions, most of which don't seem
to make a difference to performance.