-
Notifications
You must be signed in to change notification settings - Fork 8
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
[POC] Switch worker protocol from Protocol Buffers to JSON #107
Conversation
That's a pretty significant difference. Lgtm 👍 |
Doesn't |
@Kernald, yes, I’m concerned about the flag requirement as well. However, not all setups use caching — the most popular might be a CI workflow without integrated caching. I imagine entire Kotlin projects might compile faster than the |
There was a concern that enabling JSON workers would negatively impact performance, but thanks to your investigation, I think we have what we need to flip the flag. Let me do that now! |
@susinmotion, thanks for dropping by! In a couple of days I’ll be able to run the rule with the JSON protocol on an internal monorepo (thousands of targets). If you are interested, I can share results here. As much as I would like to get rid of the flag, a simple compilation of an independent rule doesn’t sound like a useful metric 😜 |
Yes, please, that'd be great! There's of course a longer conversation here, about the value of adding the functionality apart from performance, what further changes we expect to the protocol, etc., so don't worry! Your metrics aren't the be all and end all of the flag flip. |
Intermediate results from running on an internal monorepo on MacBook Pro (2.4 GHz 8-core CPU, 32 GB RAM). Cache was disabled, both invocations are basically PB:
JSON:
Basically 152 vs. 106 seconds. I suspect the difference is the time spent on compiling CC @susinmotion |
I guess one solution would be to manually build the protobuf binary right after your Another approach would be to use Bazel's profiling feature to get a sense of how long it takes exactly. |
Thanks as always Marc! According to the profile pure Detekt invocations take 102.3 seconds with the PB protocol and 104.1 seconds with the JSON protocol. However, these are single run numbers. Ideally it would be better to make multiple runs and calculate a median but not sure if it’s worth it. Also the current JSON parsing might be sub-optimal since it uses a bit of reflection while it can use streaming APIs without reflection. |
FYI — blocked by bazelbuild/bazel#13599. As part of the discussion there is a proposal to change the format to NDJSON at bazelbuild/bazel#14219. |
$ bazel clean && bazel build //detekt/wrapper:bin