riju icon indicating copy to clipboard operation
riju copied to clipboard

TypeScript env a tad slow?

Open plondon opened this issue 3 years ago • 1 comments

Hey @raxod502! I've noticed that the typescript execution env can be particularly slow, sometimes taking around 10sec to perform simple tasks, like console.logs. Any idea how that can be improved?

plondon avatar Nov 11 '21 14:11 plondon

I see this as well:

0 riju@admin:/src$ make sandbox L=typescript  
L=typescript node backend/sandbox.js
Starting session with UUID 14127ad3a0d94e6a9f1019479736a75b
riju@typescript:~/src$ time run </dev/null
ts-node -i -e "$(< main.ts)"
Hello, world!
> 
real    0m2.658s
user    0m1.524s
sys     0m0.077s
riju@typescript:~/src$ time run </dev/null
ts-node -i -e "$(< main.ts)"
Hello, world!
> 
real    0m4.293s
user    0m2.373s
sys     0m0.128s
riju@typescript:~/src$ time run </dev/null
ts-node -i -e "$(< main.ts)"
Hello, world!
> 
real    0m5.115s
user    0m2.866s
sys     0m0.139s
riju@typescript:~/src$ time run </dev/null
ts-node -i -e "$(< main.ts)"
Hello, world!
> 
real    0m4.468s
user    0m2.579s
sys     0m0.083s

It looks like disabling type-checking (per https://github.com/TypeStrong/ts-node#typechecking) speeds it up a lot, but then there's not so much point to using TypeScript...

riju@typescript:~/src$ time ts-node -i -e "$(< main.ts)" -T </dev/null
Hello, world!
> 
real    0m0.673s
user    0m0.362s
sys     0m0.066s

Might be worth reproducing on bare metal and reporting upstream. It doesn't seem reasonable for this to take so long.

raxod502 avatar Nov 16 '21 01:11 raxod502