# pydantic 2.14.2 (MIT), harvested by tools/harvest_corpus.py
=== input
The use of a two-stage cache lookup approach was necessary to have the highest performance possible for
    repeated calls to `__class_getitem__` on generic types (which may happen in tighter loops during runtime),
    while still ensuring that certain alternative parametrizations ultimately resolve to the same type.

    As a concrete example, this approach was necessary to make Model[List[T]][int] equal to Model[List[int]].
    The approach could be modified to not use two different cache keys at different points, but the
    _early_cache_key is optimized to be as quick to compute as possible (for repeated-access speed), and the
    _late_cache_key is optimized to be as "correct" as possible, so that two types that will ultimately be the
    same after resolving the type arguments will always produce cache hits.

    If we wanted to move to only using a single cache key per type, we would either need to always use the
    slower/more computationally intensive logic associated with _late_cache_key, or would need to accept
    that Model[List[T]][int] is a different type than Model[List[T]][int]. Because we rely on subclass relationships
    during validation, I think it is worthwhile to ensure that types that are functionally equivalent are actually
    equal.
    
=== parse google
short_description: |
  The use of a two-stage cache lookup approach was necessary to have the highest performance possible for
  repeated calls to `__class_getitem__` on generic types (which may happen in tighter loops during runtime),
  while still ensuring that certain alternative parametrizations ultimately resolve to the same type.
long_description: |
  As a concrete example, this approach was necessary to make Model[List[T]][int] equal to Model[List[int]].
  The approach could be modified to not use two different cache keys at different points, but the
  _early_cache_key is optimized to be as quick to compute as possible (for repeated-access speed), and the
  _late_cache_key is optimized to be as "correct" as possible, so that two types that will ultimately be the
  same after resolving the type arguments will always produce cache hits.
  
  If we wanted to move to only using a single cache key per type, we would either need to always use the
  slower/more computationally intensive logic associated with _late_cache_key, or would need to accept
  that Model[List[T]][int] is a different type than Model[List[T]][int]. Because we rely on subclass relationships
  during validation, I think it is worthwhile to ensure that types that are functionally equivalent are actually
  equal.
blank_after_short_description: True
blank_after_long_description: False
style: google
=== detect
rest
=== compose google
The use of a two-stage cache lookup approach was necessary to have the highest performance possible for
repeated calls to `__class_getitem__` on generic types (which may happen in tighter loops during runtime),
while still ensuring that certain alternative parametrizations ultimately resolve to the same type.

As a concrete example, this approach was necessary to make Model[List[T]][int] equal to Model[List[int]].
The approach could be modified to not use two different cache keys at different points, but the
_early_cache_key is optimized to be as quick to compute as possible (for repeated-access speed), and the
_late_cache_key is optimized to be as "correct" as possible, so that two types that will ultimately be the
same after resolving the type arguments will always produce cache hits.

If we wanted to move to only using a single cache key per type, we would either need to always use the
slower/more computationally intensive logic associated with _late_cache_key, or would need to accept
that Model[List[T]][int] is a different type than Model[List[T]][int]. Because we rely on subclass relationships
during validation, I think it is worthwhile to ensure that types that are functionally equivalent are actually
equal.
