Merge: Optimize `Array::add_all`
authorJean Privat <jean@pryen.org>
Sun, 28 Dec 2014 14:48:16 +0000 (09:48 -0500)
committerJean Privat <jean@pryen.org>
Sun, 28 Dec 2014 14:48:16 +0000 (09:48 -0500)
commit65f039e3788fdbb25f6aa2e98b67cf14d0985f43
treee681c74a02555f19e5c3629f783198b3603af90d
parent9b32fb74ffaebc2ce3e597d9c4f18c97bc65780e
parentbb493763043f8e52c2d34ece8fdbc72e693a877e
Merge: Optimize `Array::add_all`

Calls to `Array::add_all` were a noticable bottleneck in gammit, so I optimized it. The opimization is even more efficient when adding Arrays to Arrays, compared to adding Sequences to Arrays. It is general enough that it could be useful in the standard library (but I could also keep it in gammit if you prefer).

Speeds up the benchmark program by about 60%, with even better effects when adding larger arrays.

We could probably optimize this further at the NativeArray level but it looked more error prone.

Pull-Request: #1067
Reviewed-by: Jean Privat <jean@pryen.org>