Description
Any use of reflect.Value.MethodByName()
or reflect.Type.MethodByName()
disables the DCE. The compiler assumes that these functions will look any method up, and cannot remove methods even if they are never called.
text/template
and html/template
are very notable offenders in this respect. They call MethodByName()
on random strings extracted from template texts.
The package x/net/trace
uses html/template
, hence any user of x/net/trace
compiles with DCE disabled. Worse yet, the package's init()
references html/template
which disables DCE even if x/net/trace
is imported, but otherwise unused.
There is a very popular user of x/net/trace
, namely google.golang.org/grpc
. Essentially, this means that a lot of networked services in golang are compiled without DCE.
What did you expect to see?
I expect that a low-level library that is used by almost everyone does not pessimise the code generation by disabling the DCE. I'd avoid html/template
altogether.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status