Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using require('babel/register') vs. transpiling the code before running

Are there any performance benefits of the latter compared to the former? When I tested it on my own, the time it took for one of my projects to load already transpiled was much shorter than when it uses babel/register. Apart from start-up time though, I'm not entirely sure what I'd write to benchmark the two fairly. Does anyone know whether the overhead Babel adds is just from babel/register transpiling code as it's running, or is it slow no matter what you do?

like image 226
kpimov Avatar asked Oct 30 '22 22:10

kpimov


1 Answers

You are correct in that it affects startup time (it will drastically, depending on how large your project is). As for actual runtime, it should make exactly 0 difference unless there is a bug in Node itself (which would sadly not likely to be fixed, since it's deprecated).

like image 87
Isiah Meadows Avatar answered Nov 10 '22 14:11

Isiah Meadows