Skip to content

Instantly share code, notes, and snippets.

@SergXIIIth
Created October 27, 2015 16:29
Show Gist options
  • Save SergXIIIth/ee705b2e0798d2ca0950 to your computer and use it in GitHub Desktop.
Save SergXIIIth/ee705b2e0798d2ca0950 to your computer and use it in GitHub Desktop.
Crystal perfomance
$ crystal build src/hello.cr --release
$ time ./hello
Hello world
real 0m0.003s
user 0m0.000s
sys 0m0.004s
$ time ruby hello.rb
Hello world
real 0m0.116s
user 0m0.080s
sys 0m0.039s
@asterite
Copy link

But note that the whole difference is probably Ruby's start up. You should probably do something like:

time = Time.now
puts "Hello world"
puts Time.now - time

There I don't think there will be any difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment