perf(jsonrpc): buffer output writes in StreamMessageConsumer#905
perf(jsonrpc): buffer output writes in StreamMessageConsumer#905sebthom wants to merge 2 commits intoeclipse-lsp4j:mainfrom
Conversation
Wrap provided OutputStream in BufferedOutputStream to amortize small writes; improves throughput by reducing syscalls. Centralize wrapping via setOutput to avoid double wrapping.
8827c19 to
4386150
Compare
jonahgraham
left a comment
There was a problem hiding this comment.
This PR contains 3 different changes:
- synchronizing changes of output on outputlock (I assume so that output can't change in the middle of a message)
- fixing test suite by using atomic string
- wrapping output in buffered output stream.
1 and 2 are in principle fine - 3 has an API problem, the getOutput method now unexpectedly no longer returns what I passed in to setOutput or the constructor.
I also don't really like the need to lock to change the output - I think the output should be unchangeable. LSP4E certainly doesn't seem to change it. Not sure of others.
I would be inclined for LSP4J 1.0.0 to remove the public setOutput/getOutput and then simplify this code.
|
@jonahgraham maybe you could create another 0.x release where the getOutput/setOutput are deprecated and marked for removal. |
Major releases are API breaking. I don't think we need to deprecate it ahead of time. See https://github.com/eclipse-lsp4j/lsp4j/blob/main/README.md#published-api-changes (just merged from #921). |
Wrap provided OutputStream in BufferedOutputStream to amortize small writes; improves throughput by reducing syscalls. Centralize wrapping via setOutput to avoid double wrapping.