crystal-lang / crystal

The Crystal Programming Language
https://crystal-lang.org
Apache License 2.0
19.23k stars 1.61k forks source link

Interpereter performance is too low #12609

Open acodervic opened 1 year ago

acodervic commented 1 year ago

Bug Report

Interpereter performance is too low , less then 50%-70% of native build .

target app srouce code at https://github.com/NeuraLegion/wafalyzer.

when i it running with native build , it only took 6 s . but it runing with interperter took 5 minutes !. this is unacceptable during actual debugging the http://127.0.0.1 is my local apache2 server . it just provides a empty page .

os : ubuntu20 Linux 5.13.0-51-generic #58~20.04.1-Ubuntu SMP Tue Jun 14 11:29:12 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Crystal:Using Crystal 1.6.0 (2022-10-06) LLVM: 10.0.0 Default target: x86_64-pc-linux-gnu

xxxx@xxxx-F117-V:~/Downloads/xxxx/wafalyzer-master/wafalyzer-master$ time /home/w/Documents/localgitserver/crystal/bin/crystal     src/cli.cr  http://127.0.0.1
Using compiled compiler at /home/xxxx/Documents/localgitserver/crystal/.build/crystal

No WAF detected

real    0m6.682s 
user    0m6.474s
sys     0m0.562s

xxxx@xxxx-F117-V:~/Downloads/xxxx/wafalyzer-master/wafalyzer-master$ time /home/xxxx/Documents/localgitserver/crystal/bin/crystal     i src/cli.cr  http://127.0.0.1
Using compiled compiler at /home/xxxx/Documents/localgitserver/crystal/.build/crystal

No WAF detected

real    4m45.937s
user    4m45.578s
sys     0m0.294s

thank for crystal team . please fix this . this is very important for every developer !

asterite commented 1 year ago

Did you compile the interpreter in release mode?

asterite commented 1 year ago

I also don't understand why why you need the performance. When you debug something you don't need to run the full program.

Fryguy commented 1 year ago

The purpose of the interpreter is that you are trading compilation time for execution time so that you can quickly start and step through your code for debugging purposes. By definition the code will run slower, however the debug/edit loop is significantly faster in human time.

beta-ziliani commented 1 year ago

Hi @acodervic , thanks for reporting, but we're still far from the point in which optimizing the interpreter is a good use of resources. We still need to work on to make it accessible to most platforms, and to polish its rough edges. Speed is a nice to have feature at this point.

asterite commented 1 year ago

I think @straight-shoota suggested somewhere to do make interpreter=1 to have the interpreter, but I can't remember where. It should include release=1 as it makes a huge difference.

acodervic commented 1 year ago

Hi @acodervic , thanks for reporting, but we're still far from the point in which optimizing the interpreter is a good use of resources. We still need to work on to make it accessible to most platforms, and to polish its rough edges. Speed is a nice to have feature at this point.

ok , thank for you anser.

asterite commented 1 year ago

@acodervic are you using the interpreter compiled in release mode? It would save us all a discussion 😅