optimize flatten; memoize inline fragments
optimize flatten; memoize inline fragments

Summary:
More optimizations for flatten transform:
* Pass parent_type as `Type`, which is a small copy-able type rather than `&TypeReference` which is boxed and has to be cloned. We only ever use the inner `Type` anyway.
* This allows us to cache `InlineFragments` by the pair of the fragment identity (address) and the parent type `(PointerAddress, Type)`
* That alone wasn't a speedup since it meant a lot more cache checks, which increases contention between threads. But as we might expect, many fields/fragments aren't actually shared and have just a single reference, so there's no point caching them. And if we aren't going to cache them, then we don't have to waste time acquiring a read or write lock, which allows us to get more of the benefits of parallelization.

Reviewed By: alunyov

Differential Revision: D22048763

fbshipit-source-id: 058744c4a7c5a38d55cf99e3a39c2194febd920b

kassens/relay,yungsters/relay,kassens/relay,voideanvalue/relay,wincent/relay,voideanvalue/relay,voideanvalue/relay,atxwebs/relay,wincent/relay,facebook/relay,kassens/relay,atxwebs/relay,wincent/relay,atxwebs/relay,josephsavona/relay,xuorig/relay,facebook/relay,facebook/relay,wincent/relay,wincent/relay,xuorig/relay,josephsavona/relay,yungsters/relay,facebook/relay,voideanvalue/relay,facebook/relay,xuorig/relay,xuorig/relay,kassens/relay,facebook/relay,voideanvalue/relay,voideanvalue/relay,xuorig/relay,kassens/relay,atxwebs/relay,wincent/relay,yungsters/relay,xuorig/relay,kassens/relay,josephsavona/relay