Commits
Mark Lacey committed a8944f4540d
Enable mandatory inlining of generic functions with unbound generic types.
This allows us to inline @transparent functions in cases like this:
@transparent
func partial<T, U>(x: T, f: (T) -> U) -> U {
return f(x)
}
func applyPartial<U>(x: Int32, f: (Int32) -> U) -> U {
return partial(x, f)
}
I had planned on enabling this same behavior in the performance inliner
first in order to be able to test the underlying functionality more
thoroughly, but I hit a blocking issue pretty quickly in type
lowering (rdar://problem/19387372).
Given that @transparent is not currently user-facing, it seems
reasonable to go ahead and enable this now and fix any new issues it
exposes since it should be easy to work around those issues by not using
@transparent.
There were lots of performance differences as a result of this change,
mostly positive. Below I list the 10 largest improvements for each of
-Onone, -O, and -Ounchecked, along with all regressions greater than
10%. I will be opening radars for these.
-Onone
---------------------------------------
ArrayOfPOD 104.200%
ArrayOfGenericPOD 40.700%
TwoSum 37.800%
EditDistance 35.600%
GenericStack 33.500%
SwiftStructuresStack 29.700%
SwiftStructuresInsertionSort 29.300%
Havlak 27.200%
NestedLoop 26.800%
Life 26.400%
SwiftStructuresTrie -15.500%
-O
---------------------------------------
TwoSum 46.200%
GenericStack 37.900%
SwiftStructuresStack 37.100%
Dictionary 30.200%
Forest 27.800%
NSDictionaryImplicitConversion 24.400%
Prims 23.500%
Dictionary2 19.600%
DollarFilter 17.00%
SwiftStructuresQueue 16.600%
NSStringConversion -22.600%
SwiftStructuresTrie -25.900%
PopFrontArray -44.100%
-Ounchecked
---------------------------------------
SwiftStructuresStack 38.900%
GenericStack 37.400%
NSDictionaryImplicitConversion 21.200%
TwoSum 20.500%
Histogram 16.600%
DollarFilter 15.900%
DollarFunction 13.600%
ArrayLiteral 12.900%
Forest 12.300%
Prims 10.300%
ImageProc -10.900%
InsertionSort -11.200%
StrToInt -11.800%
NBody -14.900%
SwiftStructuresTrie -29.900%
Swift SVN r24263