Slow performance

puts "hello world"
takes a second or more to run.

I have followed the standard instructions to install crystal. (used this link to install: Install package devel:languages:crystal / crystal) I can run my test project trough ‘crystal’. But there is something strange. Crystal should be really fast but the simple hello world program takes about a second(!) to run which is incredibly slow. Is there something I can check to get way better performance? I am surprised by the slow result and I want to know what causes this :slight_smile:

If you are just running crystal do remember that is compiling the program before running it. If you want to test the actual runtime performance of it you should do like:

crystal build --release
time ./test

Then there is one thing I don’t understand. I have tried multiple programming languages and all of them(like python) give their result on simple programs like the hello world program in about 38ms(python) while crystal takes about a second. What should I run if I want to quickly scratch and test a function; how is it meant? trying to setup sublime text to test for a while :slight_smile:

Python is an interpreted language. It doesn’t need to compile anything so of course the initial startup time is going to be quicker. There’s not really a way around it. Each time you want to to test a change you’re going to need to recompile the program which is going to take some amount of time.

Of course you only need to do this while developing. Once the program is good to go you can build the final release binary once then use that going forward.

EDIT: To clarify once you have a built release binary the startup time should be essentially instant as it has already been compiled.


That’t the trade-off of compiled languages: You pay for compile time cost up front. But execution of compiled code is much more efficient than an interpreter.


Ah I just didn’t know that. Thank you all!