]> Cypherpunks repositories - gostls13.git/commit
runtime: speed up makeslice by avoiding divisions
authorMartin Möhrmann <martisch@uos.de>
Sun, 10 Apr 2016 15:32:35 +0000 (17:32 +0200)
committerIan Lance Taylor <iant@golang.org>
Sun, 10 Apr 2016 23:39:46 +0000 (23:39 +0000)
commitad7448fe982d83de15deec9c55c56d0cd9261c6c
treee4d44cc145b562c0b1e184a4a5d2bec78b8cdfd3
parent5b3e5766bcc5e1090d0512a5916886ffc24ab246
runtime: speed up makeslice by avoiding divisions

Only compute the number of maximum allowed elements per slice once.

name         old time/op  new time/op  delta
MakeSlice-2  55.5ns ± 1%  45.6ns ± 2%  -17.88%  (p=0.000 n=99+100)

Change-Id: I951feffda5d11910a75e55d7e978d306d14da2c5
Reviewed-on: https://go-review.googlesource.com/21801
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/append_test.go
src/runtime/slice.go