• Martin Möhrmann's avatar
    cmd/compile: generate makemap calls with int arguments · cbc4e5d9
    Martin Möhrmann authored
    Where possible generate calls to runtime makemap with int hint argument
    during compile time instead of makemap with int64 hint argument.
    
    This eliminates converting the hint argument for calls to makemap with
    int64 hint argument for platforms where int64 values do not fit into
    an argument of type int.
    
    A similar optimization for makeslice was introduced in CL
    golang.org/cl/27851.
    
    386:
    name         old time/op    new time/op    delta
    NewEmptyMap    53.5ns ± 5%    41.9ns ± 5%  -21.56%  (p=0.000 n=10+10)
    NewSmallMap     182ns ± 1%     165ns ± 1%   -8.92%  (p=0.000 n=10+10)
    
    Change-Id: Ibd2b4c57b36f171b173bf7a0602b3a59771e6e44
    Reviewed-on: https://go-review.googlesource.com/55142Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    cbc4e5d9
makemap.go 1.27 KB