philhofer
295307ae78
cmd/compile: de-virtualize interface calls
...
With this change, code like
h := sha1.New()
h.Write(buf)
sum := h.Sum()
gets compiled into static calls rather than
interface calls, because the compiler is able
to prove that 'h' is really a *sha1.digest.
The InterCall re-write rule hits a few dozen times
during make.bash, and hundreds of times during all.bash.
The most common pattern identified by the compiler
is a constructor like
func New() Interface { return &impl{...} }
where the constructor gets inlined into the caller,
and the result is used immediately. Examples include
{sha1,md5,crc32,crc64,...}.New, base64.NewEncoder,
base64.NewDecoder, errors.New, net.Pipe, and so on.
Some existing benchmarks that change on darwin/amd64:
Crc64/ISO4KB-8 2.67µs ± 1% 2.66µs ± 0% -0.36% (p=0.015 n=10+10)
Crc64/ISO1KB-8 694ns ± 0% 690ns ± 1% -0.59% (p=0.001 n=10+10)
Adler32KB-8 473ns ± 1% 471ns ± 0% -0.39% (p=0.010 n=10+9)
On architectures like amd64, the reduction in code size
appears to contribute more to benchmark improvements than just
removing the indirect call, since that branch gets predicted
accurately when called in a loop.
Updates #19361
Change-Id: I57d4dc21ef40a05ec0fbd55a9bb0eb74cdc67a3d
Reviewed-on: https://go-review.googlesource.com/38139
Run-TryBot: Philip Hofer <phofer@umich.edu >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: David Chase <drchase@google.com >
2017-03-14 18:49:23 +00:00
..
2017-01-20 05:55:53 +00:00
2016-12-13 22:04:23 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2017-03-13 19:39:15 +00:00
2016-05-02 13:43:18 +00:00
2015-10-07 14:37:44 +00:00
2016-11-02 21:33:03 +00:00
2016-09-12 19:26:31 +00:00
2016-04-03 17:03:15 +00:00
2017-02-08 20:59:45 +00:00
2014-01-07 13:26:48 +01:00
2016-05-02 13:43:18 +00:00
2017-02-24 18:54:36 +00:00
2016-07-06 20:48:41 +00:00
2016-04-24 21:36:52 +00:00
2016-05-02 13:43:18 +00:00
2017-01-25 08:04:17 +00:00
2017-01-20 05:55:53 +00:00
2016-05-02 13:43:18 +00:00
2014-10-06 17:16:39 -04:00
2016-03-17 04:20:02 +00:00
2015-12-02 18:26:38 +00:00
2013-10-08 14:36:20 -04:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2014-12-08 22:18:17 +00:00
2017-03-04 16:13:07 +00:00
2014-10-31 11:08:27 -04:00
2015-01-29 13:07:30 +00:00
2015-02-03 15:48:48 +00:00
2014-01-31 00:30:56 +01:00
2015-06-26 03:38:21 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2013-12-12 17:18:12 -08:00
2015-07-11 14:36:33 +00:00
2015-07-11 14:36:33 +00:00
2016-05-02 13:43:18 +00:00
2016-09-17 01:12:24 +00:00
2016-05-02 13:43:18 +00:00
2016-10-04 17:10:47 +00:00
2015-05-07 23:54:28 +00:00
2016-10-28 21:53:07 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2014-01-24 22:35:11 +04:00
2016-05-02 13:43:18 +00:00
2017-03-14 18:49:23 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-06-28 22:09:00 +00:00
2017-02-27 21:31:04 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-10-26 18:46:59 +00:00
2016-05-02 13:43:18 +00:00
2017-02-15 01:33:03 +00:00
2016-05-02 13:43:18 +00:00
2016-10-10 12:09:16 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2014-12-08 22:22:58 +00:00
2015-11-03 18:57:18 +00:00
2016-09-14 16:39:47 +00:00
2016-05-02 13:43:18 +00:00
2013-03-15 15:24:13 -04:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2015-11-12 18:32:13 +00:00
2013-12-12 19:02:11 -08:00
2016-05-02 13:43:18 +00:00
2017-02-10 01:22:30 +00:00
2017-02-10 01:22:30 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2017-03-06 23:48:37 +00:00
2015-09-05 02:25:01 +00:00
2017-03-03 21:29:32 +00:00
2016-11-30 19:46:00 +00:00
2016-05-02 13:43:18 +00:00
2016-09-12 19:26:31 +00:00
2016-09-19 19:03:01 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2015-12-17 23:36:13 +00:00
2016-05-02 13:43:18 +00:00
2017-02-08 20:59:45 +00:00
2016-05-09 17:31:45 +00:00
2016-04-20 17:37:35 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-10-31 19:38:50 +00:00
2016-10-31 19:38:50 +00:00
2017-03-13 23:43:16 +00:00
2017-03-06 15:05:42 +00:00
2017-03-08 18:52:12 +00:00
2016-05-02 13:43:18 +00:00
2014-08-06 17:02:55 -04:00
2014-10-27 18:59:02 -04:00
2016-03-17 00:38:15 +00:00
2016-10-18 05:32:37 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2017-02-17 19:19:59 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-12-15 22:43:28 +00:00
2016-10-15 17:58:14 +00:00
2017-02-01 22:52:32 +00:00
2016-10-15 17:58:11 +00:00
2016-10-25 22:28:40 +00:00
2017-01-09 21:01:29 +00:00
2016-09-13 20:06:13 +00:00
2014-07-31 13:48:48 -07:00
2014-07-31 13:48:48 -07:00
2017-02-02 17:45:58 +00:00
2017-02-28 08:23:52 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-03-11 21:19:20 +00:00
2016-03-11 21:19:20 +00:00
2016-03-11 21:19:20 +00:00
2016-03-11 22:07:02 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2017-02-11 21:46:21 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2017-03-09 23:29:49 +00:00
2016-05-02 13:43:18 +00:00
2017-03-01 01:06:32 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2014-01-29 09:28:23 +01:00
2015-05-21 17:32:17 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-10-27 20:22:49 +00:00
2016-03-30 22:27:13 +00:00
2013-12-12 17:17:02 -08:00
2016-05-02 13:43:18 +00:00
2016-08-19 01:10:21 +00:00
2017-02-10 01:22:30 +00:00
2017-02-02 17:36:43 +00:00
2015-11-03 18:57:18 +00:00
2014-07-01 09:20:51 +02:00
2014-01-03 21:03:20 +01:00
2015-09-06 23:50:51 +00:00
2017-02-10 01:22:30 +00:00
2016-10-31 19:38:50 +00:00
2016-07-06 20:48:41 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2017-02-07 17:23:23 +00:00
2016-12-23 17:35:24 +00:00