• Martin Möhrmann's avatar
    cmd/compile: generate makeslice calls with int arguments · e6f9f39c
    Martin Möhrmann authored
    Where possible generate calls to runtime makeslice with int arguments
    during compile time instead of makeslice with int64 arguments.
    
    This eliminates converting arguments for calls to makeslice with
    int64 arguments for platforms where int64 values do not fit into
    arguments of type int.
    
    godoc 386 binary shrinks by approximately 12 kilobyte.
    
    amd64:
    name         old time/op  new time/op  delta
    MakeSlice-2  29.8ns ± 1%  29.8ns ± 1%   ~     (p=1.000 n=24+24)
    
    386:
    name         old time/op  new time/op  delta
    MakeSlice-2  52.3ns ± 0%  45.9ns ± 0%  -12.17%  (p=0.000 n=25+22)
    
    Fixes  #15357
    
    Change-Id: Icb8701bb63c5a83877d26c8a4b78e782ba76de7c
    Reviewed-on: https://go-review.googlesource.com/27851
    Run-TryBot: Martin Möhrmann <martisch@uos.de>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
    e6f9f39c
issue4085b.go 1.35 KB