[stdlib] add two-operand version of max and use max2 in stdlib when appropriate.

This helps array append's performance by ~ 2x. The generic max with a variadic
argument creates a temporary array then iterates over the array.

rdar://17140639 rdar://17073827


Swift SVN r18764
This commit is contained in:
Manman Ren
2014-06-09 23:56:40 +00:00
parent c8ac91e4c7
commit cc90c81239
6 changed files with 16 additions and 8 deletions

View File

@@ -90,7 +90,7 @@ struct _StringBuffer {
// Allocate storage
self = _StringBuffer(
capacity: max(utf16Count, minimumCapacity),
capacity: max2(utf16Count, minimumCapacity),
initialSize: utf16Count,
elementWidth: isAscii ? 1 : 2)