Comments (10)
It might be a good idea to add a method, it's not there because it needs another dependency and it's oneliner. But I'm not sure about caching.
Is it really justified by benchmarks or it's just an idea?
from tk-http.
Just compared (code here: https://github.com/nayato/hyper-test/tree/a618125e2ee34900742cdec54d92c28ef021ea34) and in such a basic setup difference is ~18% (154K req/sec without caching Date vs 182K with).
from tk-http.
Hm, that's a pretty large difference. Can you also try httpdate
insead of time
crate? (httpdate has a hardcoded date format, so might be faster). We might also just need to add inline(always)
to format_header
(because it's in the different crate it might not get inlined).
BTW, how tk-http compares to hyper? (I see example in your repo)
from tk-http.
Hyper - 223K, same functionality.
from tk-http.
tried non-cached httpdate and re-ran benchmark on a different VM.
hyper: 212K
tk-http, cached date using time crate: 201K
tk-http using httpdate (no caching added): 186K
from tk-http.
194K with httpdate, no caching when with this change nayato/hyper-test@5590d99
from tk-http.
Okay with this kind of difference there is much less sense for caching. In more real workload it should not be noticeable at all.
Still it's unfortunate that tk-http is slower than hyper :) How do you benchmark? It would be nice that I could replicate the test and see if something might need to be fixed in tk-http. Also, typical benchmarks like ab
tend to send two request headers, while normal browser send ~10, and that may be important since the two libraries handle headers in a very different way.
from tk-http.
I benchmarked with wrk, without pipelining, on two Ubuntu 16.04 VMs in Azure - 4 core server (D3v2), 16 core client (F16, but may go lower here).
I agree on real life perf diff not being big. On dependency mgmt, considering how ubiquitous Date header in HTTP is, I sure wouldn't mind having OOTB support for stamping it. Also, considering how small and focused httpdate is... 😉
from tk-http.
Done. Releasing in v0.3.6 (waiting on travis).
I have some motivation to tackle the overall performance difference, but not sure if I'll have spare time for that. Feel free to open issue if you have another idea or just to discuss performance.
from tk-http.
We're also going to improve the performance of httpdate itself: pyfisch/httpdate#2
from tk-http.
Related Issues (15)
- Check header validity
- Fix pushback HOT 4
- Implement 100-Expect support
- Use a smaller but growable buffers for headers (httparse)
- handle "100 continue" response
- Windows 10: Connection error: I/O error: An established connection was aborted by the software in your host machine. HOT 8
- Integrating with tokio-tls HOT 5
- Sending websocket `Packet`s of shared data HOT 2
- Encoder.done_headers should return false when content-length=0 HOT 1
- TLS server example HOT 1
- Websocket example is missing updated Tokio support
- Limit number of `InFlight` requests
- Handling of `Connection: close` HOT 1
- Implement request body HOT 1
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 tk-http.