pattern: optimize forking of matcher
pattern: optimize forking of matcher

A binding can be set at most once, so instead of creating new maps when
forking, just create a checkpoint and remember which bindings we've set
after the checkpoint. When rolling back, we just have to delete the
bindings that were set. Doing it this way is much easier on the GC. And
since the number of bindings tends to be around 1, deleting bindings has
negligible cost.

dominikh/go-tools,dominikh/go-tools,dominikh/go-tools,dominikh/go-tools