-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
only include quic-trace when the quictrace build flag is set #2799
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2799 +/- ##
=======================================
Coverage 86.02% 86.02%
=======================================
Files 133 133
Lines 12063 12063
=======================================
Hits 10376 10376
Misses 1355 1355
Partials 332 332 Continue to review full report at Codecov.
|
One of the issues with using a build tag is that it means it cannot be used in libraries. I.e. everyone using a library would need to modify their setup and similarly when building. There are few other ways. One is to serialize pb manually. As an example pprof uses this approach https://golang.org/src/runtime/pprof/protomem.go. The other is to separate the implementation and interface into separate packages. So, if you don't import I'll take a look at the size difference thing... |
That's a feature here, not a bug. quic-trace is not intended to be used in production anyway. If you want logging / tracing, we have a better interface for that now ( |
Ah, sorry I misunderstood... I was thinking you would need to use |
So based on preliminary research:
The only package difference seems to be Few interesting differences in compiled sizes between the client and server without quictrace:
I need to add some new features to goda to get some better info. |
I'm not familiar with goda, so I'll need a bit of help with the output. Can you confirm that protobuf is not included in the binary when compiling without the The difference in the size of gojay is surprising. There shouldn't be any significant differences between client and server, as both of them use that library for qlog support. |
Says, take the package graph (including std packages) of So, yes, for both server and client protobuf is removed from dependency graph. |
My main guess is that something is calling |
We do use reflection in the frame parser, for generating an error message: https://github.com/lucas-clemente/quic-go/blob/93e733a860ec78de71bf5f4b0912f644ccdcab0a/internal/wire/frame_parser.go#L97-L99 Also, reflections are used for sanity checks in the qtls package: |
Those shouldn't affect it. AFAIR only things like https://golang.org/pkg/reflect/#Value.Call cause it. |
Missed another one in https://github.com/lucas-clemente/quic-go/blob/93e733a860ec78de71bf5f4b0912f644ccdcab0a/session.go#L1116-L1118 For reference, the ack --ignore-dir=mocks --ignore-file="match:/(.*)_test.go$" --go reflect |
So, yeah these two methods:
https://golang.org/src/cmd/link/internal/ld/deadcode.go#L227 |
We're not using those, so we should be safe. |
Clearly, something is using them in the server code. See output from:
|
Interesting. I guess it's something outside of quic-go then, and it's not qtls. gojay seems to use reflect at a few places (although it claims not to use reflection), but not Any idea how to find the culprit without manually grepping through all dependencies? |
Yeah, trying to find a way to find it. It seems there should be a symbol attribute for all the funcs https://github.com/golang/go/blob/master/src/cmd/internal/obj/link.go#L508 for it, however, I'm still trying to find a way to read it from the binary. |
Ok, figured it out. The server imports |
That's an artifact of the example server then, and doesn't affect normal usage of the library. Thanks for digging into this! |
I made a corresponding issue golang/go#41569. I think it should be possible to make net/http/pprof better. |
Fixes #2797.
I'm not ready to drop quic-trace yet, but it turns out to be really easy to hide behind a build tag.
With quic-trace:
Without quic-trace:
Not sure why the difference is so much bigger for the client. @egonelbre any ideas?