-
Notifications
You must be signed in to change notification settings - Fork 642
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 prism (Crystal) #184
Comments
Oh, I personally find it useless. Each Crystal framework is ultra-fast and the micro-differences only depend on amount of features a framework has. Prism uses the same Radix tree implementation as others to resolve paths, so I don't think it makes any sense. |
I understand you point of view, but I disagree.
If you see the results (of some other benchmarks), we notice it a difference between frameworks, and it could be interesting to display those informations 😛 |
Crystal itself is single-core fast, but as a server it is dreadfully slow because of the way these keep getting implemented. As the Crystal devs themselves stated, the servers need to be run one per core with REUSE socket enabled. Running them as they are in this benchmark is entirely wrong, so before more are added, the existing ones need to be fixed first. |
Crystal looks like a very interesting language. However, attracting people to it on the basis of these benchmarks is counter-productive. As soon a people try doing anything beyond a trivial 'hello world' these benchmarks collapse. As an example, JSON processing in crystal is only fractionally faster than writing the data down by hand, scanning it, and sending it to the user via email :-) |
The purpose of this benchmarking project is not to attract people on crystal. The main idea is to compare tools (frameworks) |
@andymans, see https://carc.in/#/r/43pg
100k+ on my 0.9Ghz machine. Multiplied by 4 cores ($2.99 on Scaleway) results in 400k+ per second. It should be more than enough for the most of applications 🤔 Attracting people to it on the basis of these benchmarks is actually a good thing, because if another language framework sucks even with hello world, it's a reason to think of migrating to an initially faster solution 👍 BTW, I'm finishing Crystal version of http://realworld.io and it literally kills other languages 🔫 |
Excellent - very much look forward to seeing the result! The realworld is a useful app specifically because it tests > 1 facet - e.g. the router, json, plus non-infrastructure items such as jwt etc. To my mind, a good score on realworld is a far more realistic yardstick of what the language can deliver. |
How so in what way? I'd love to see a blog on how! :-) |
@OvermindDL1 I'll definitely post a Medium article on this! |
@vladfaust Awesome, ping me with the URL when it's up? :-) |
@vladfaust You seems to be right. On the last test https://github.com/waghanza/which_is_the_fastest/blob/wrk/README.md#ranking-framework all |
So, I'm benchmarking it on my Xiaomi Mi Air 12':
Wrk script with threads = cpu_count + 1: printf "> Running GET /\n"
wrk -t5 -d15s -c1000 http://127.0.0.1:3000
printf "\n> Running POST /\n"
wrk -s bench/wrk/post.lua -t5 -d15s -c1000 http://127.0.0.1:3000
printf "\n> Running GET /user/42\n"
wrk -t5 -d15s -c1000 http://127.0.0.1:3000/user/42 Prismrequire "prism"
struct UserAction
include Prism::Action
include Prism::Action::Params
params do
type id : Int32
end
def call
text(params[:id])
end
end
router = Prism::Router.new do
on "/", methods: %w(get post)
get "/user/:id", UserAction
end
server = Prism::Server.new([router])
server.bind_tcp(3000, reuse_port: true)
server.listen Results for a single server instance:
Results for 4 server instances:
Kemal@ v0.24.0 require "kemal"
Kemal.config do |cfg|
cfg.serve_static = false
cfg.logging = false
end
get "/" do |env|
nil
end
get "/user/:id" do |env|
env.params.url["id"]
end
post "/user" do |env|
nil
end
Kemal.config.env = "production"
Kemal.run do |cfg|
cfg.server.not_nil!.bind_tcp 3000, reuse_port: true
end Results for a single server instance:
Results for 4 server instances:
TL;DR: Requests/seci stands for instance
@sdogruyol I took Kemal code from this repo, it may be outdated, can it be improved for more performance? Edit: I took Kemal for comparison because it's the one I've had experience with, and it is "sinatra-like", just like Prism. I haven't benched other frameworks. Edit: Added Raze. |
@vladfaust Thanks for update 😛
is not true btw, the results here are no ready for any conclusion ;-) the code is quite update, so thanks for yours ❤️ |
@aichholzer the comment above is indeed very interesting, but the assumption that this project is trying to attract people in crystal community is wrong ;-) |
@waghanza we should find a way to test multiple instances of Crystal servers. |
@vladfaust what do you mean by multiple instances ? |
@vladfaust I did: #333 (comment) |
ah ok, using if you have time to |
https://github.com/vladfaust/prism
ping @vladfaust
The text was updated successfully, but these errors were encountered: