Original code is located at master
branch
sudo apt-get install -y build-essential gcc-multilib
cd {/YOUR/PATH/TO/}QuickJS
make
create a hello_world1.js javascript file
console.log('hello world')
goto command line and type
> ./qjsc -o hello_world1 ./hello_world1.js
> ./hello_world
> hello world
create a hello_world2.js javascript file
import * as std from 'std'
console.log(std.getenv('hello'))
goto command line and type
> ./qjsc -o hello_world2 ./hello_world2.js
> SyntaxError: unsupported keyword: import
> ./qjsc -m -o hello_world2 ./hello_world2.js
> hello="hello world 2" ./hello_world2
> hello world 2
- doesn't support Blob
- doesn't support WebWorker
- compiled executable of
qjsc
does not has speed advantage compared with interpreting script withqjs
test it yourself
# run benchmark with interpretor
./qjs tests/microbench
# run benchmark with compiler
./qjsc -o microbench tests/microbench
./microbench