mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SIL] Avoid std::function in transform-iterators
In a non-rigorous test, this change shaves off 20% of the time spent in SIL optimizations for the standard library in a +Asserts build. (Admittedly the wins for a no-asserts build will be much lower because SILInstructionResultArray has a bunch of assertions in its constructor.)
This commit is contained in:
@@ -1354,7 +1354,7 @@ operator==(const SILInstructionResultArray &other) {
|
||||
|
||||
SILInstructionResultArray::type_range
|
||||
SILInstructionResultArray::getTypes() const {
|
||||
std::function<SILType(SILValue)> F = [](SILValue V) -> SILType {
|
||||
SILType (*F)(SILValue) = [](SILValue V) -> SILType {
|
||||
return V->getType();
|
||||
};
|
||||
return {llvm::map_iterator(begin(), F), llvm::map_iterator(end(), F)};
|
||||
|
||||
Reference in New Issue
Block a user