buckets: keep buckets always sorted

Relieves the templates from the burden of having to sort the
bucket contents, often multiple times.
core: add a addr() resolution cache for render performance

node.addr() can be called repeatedly a zillion times from templates
and profiling has showed it being a bottleneck in some cases.