Use pthread TLS to avoid the NSThread overhead.

All the -objectForKey: and -isEqual: calls add up.
Don't need foreign keys anymore, but we also don't need full synchronicity.
Only insert a new transaction and update head when the transaction commits.

This is hugely more performant because it means 2 additional inserts
per transaction instead of 2 additonal inserts per add.