[TypeInfo] Improve performance and cleanup
This change applies a change previously done for PropertyInfo also to TypeInfo. Both classes work in a very similar way. The actual typeinfo (private) is immutable and can be shared as a global static, there is no need to allocate it for each instance. Most importantly, this also removes the localization calls from the constructor, delaying it to the invocation of "displayName" (which for many use cases is never called). Default constructor is sped up by ~50 times, construction from name by 10...30 times, constructing a typeInfo and invoking `displayName` is mostly unchanged (dominated by the i18n call). time [usecs] per iteration archive spreadsheet folder -- benchmarkTypeInfo -- old: 0.381 0.380 0.370 new: 0.006 0.007 0.008 -- benchmarkTypeInfoFromName -- old: 0.450 2.30 3.40 new: 0.039 0.097 0.110 -- benchmarkTypeInfoDisplayName -- old: 0.390 0.385 0.370 new: 0.350 0.360 0.350 This also provides the basis for some more cleanup.
parent
761ba7c0
Please register or sign in to comment