Comments (2)
The previous implementation used to a
remaining_msg_bytes
field to returnOk(None)
immediately if the message payload wasn't entirely buffered into memory. By contrast, thelspower
implementation attempts to blindly reparse the headers withhttparse
every time.
You are right about this. It's strange because I clearly remember doing some debugging and seeing opportunities to minimize the reparsing.
In fact, it looks like at one point I did still use that field but removed it in a refactoring: silvanshade/lspower@c642b2b
But that refactoring actually seems to have done the opposite of what I claimed. I must have been confused or maybe rebased things incorrectly and didn't notice somehow.
I think should be pretty easy to add in a
remaining_msg_bytes
field into the new codec so that it truly runs as fast as it claims, though.
Indeed it is. You can see how I did it here: silvanshade/lspower@c642b2b#diff-ca14eabd5ab83f72548cd7e44eaea3f56a5d2808e3275c6b2a97622ebe5d1dd0L156-L161
Also, I've identified another optimization that would also boost efficiency beyond both the original and
lspower
codec implementations: it would be nice if we could eagerly advance thesrc
buffer past the HTTP headers once we're done parsing them, so that we don't need to re-runhttparse
each time the codec is still waiting for the payload to come through.
Yes, this was in fact the original intention behind what I was trying to do (that and the fast advance with twoway
). In fact, it makes more sense to me now why I was storing header_len
and content_len
in the codec state (which I removed in the PR I sent). I couldn't figure out why I had stored them there, but it was precisely because of this (before I made the incorrect change in the linked commit).
I could either create a PR to go back to this behavior or if you want to just go ahead implement it yourself (or maybe already have) that would be great.
from tower-lsp.
Perhaps we could also add a criterion.rs bench test to the repo, so we can keep proper tabs on the actual performance of the codec rather than speculating.
from tower-lsp.
Related Issues (20)
- `lsp-types` dependency out of date HOT 3
- Background task HOT 4
- Release with lsp-types 0.94.0 HOT 2
- Implement support for diagnostic requests on server HOT 6
- Implement support for client initiated $/progress HOT 1
- Implement support for server initiated $/progress HOT 1
- Restrict JSON-RPC request/notification params to objects and arrays HOT 2
- Concurrent requests without `Send` requirement for single threaded runtimes HOT 8
- Notification methods return Invalid request HOT 6
- Split the generic lsp-like backend from the lsp-specific implementation HOT 2
- Allow custom methods to override default method signature HOT 2
- Layer example does not work? HOT 5
- Server may not be exiting correctly after receiving `exit` notification HOT 3
- Try `lsprotocol` as the LSP types provider dependency
- Re-export `serde_json::Value` HOT 1
- Won't Compile HOT 2
- custom methods for notification without params not called HOT 6
- Header must provide a Content-Length property HOT 3
- Add `RequestFailed` and `ServerCancelled` LSP specific error codes?
- unreachable panicked in tower-lsp
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tower-lsp.