-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Add Rust hyper http benchmark #1043
Conversation
tools/http_benchmark.py
Outdated
go_build_cmd = ["go", "build", "-o", tmp_prog, "tools/go_net_http.go"] | ||
subprocess.call(go_build_cmd) | ||
print "http_benchmark testing GO net/http." | ||
return run([tmp_prog, ADDR.split(":")[1]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding Go as a dep is pretty heavy - it's a whole new runtime that we don't use currently. Could you instead use a hyper http server - EG https://github.com/hyperium/hyper/blob/master/examples/hello.rs
You can add a new rust_binary("hyper_hello")
to //BUILD.gn
In both rust and go, they are going to be an order of magnitude or more faster than we can ever achieve with a single threaded dynamic runtime. However it will provide something to strive for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
ddcdf8d
to
cf795bb
Compare
BUILD.gn
Outdated
@@ -137,6 +138,11 @@ rust_executable("deno_ns") { | |||
] | |||
} | |||
|
|||
rust_executable("hyper_hello") { | |||
source_root = "tools/hyper_hello.rs" | |||
extern = main_extern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extern = [ "$rust_build:hyper" ]
tools/http_benchmark.py
Outdated
return { | ||
"deno": deno_rps, | ||
"node": node_rps, | ||
"rust hyper": rust_hyper_http_rps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! This is going to be humbling.
tools/http_benchmark.py
Outdated
return { | ||
"deno": deno_rps, | ||
"node": node_rps, | ||
"rust hyper": rust_hyper_http_rps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/rust hyper/hyper/
I think we should keep these label names short and without spaces.
tools/http_benchmark.py
Outdated
def http_benchmark(deno_exe): | ||
deno_rps = deno_http_benchmark(deno_exe) | ||
node_rps = node_http_benchmark(deno_exe) | ||
def rust_hyper_http_benchmark(hyper_hello_exe): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/rust_hyper_http_benchmark/hyper_http_benchmark/
For some reason I could not pass AppVeyor build after reducing extern to only Also, in my benchmarks on both Fedora and Mac machines, I noticed that while Req/Sec is better than Node, Transfer/Sec is only about half. Probably need to benchmark this also |
6326556
to
4a071d9
Compare
@kevinkassimo libc would be my guess too. Let's see if that fixes it. Regarding the benchmarks - we might have to debug it a bit. Were you using the release build? |
@ry Yeah it’s release build. |
On my Fedora machine:
|
Kevin, that looks about right. Probably node has more headers. |
Hmm yeah, might be the reason. |
487200b
to
0f936d5
Compare
0f936d5
to
4014261
Compare
@ry it was |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - cool thanks for this
This did not go through We really need lack of this to fail the build. |
@kitsonk sorry about that... I probably forget to run format again as I was busy addressing issues and extern problems... Adding a guard against this should definitely help |
Now that we have rustfmt in third party it should be easier to do this now. |
Awesome - now you have a proper reference point to work towards 👍 |
No description provided.