How startup works in Nelua execution process #85
-
I have noticed the following behavior: when I delete On recompiling other sources, the startup speed drops but usually remains around 30 to 40 milliseconds approximately, give or take depending on the situation; the screenshot below is an exception though due to the nature of the code. My question is, what does it cause the delay? Is it compiler's cold startup on first execution? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
The compiler startup just load lua files, and check some disk files. What you are experience is probably something related to your OS, when you delete the folder probably the OS is invalidating files cache and when you startup again the OS need to recache the files. You could confirm this executing the following: sudo sh -c "echo 3 > /proc/sys/vm/drop_caches" For instance once the OS cache Nelua files, the startup takes about 20ms here, but when I drop the caches it takes more than 100ms: ➜ nelua-lang git:(master ✓) nelua -tb --no-cache examples/helloworld.nelua
startup 22.6 ms
parse 1.5 ms
preprocess 0.0 ms
analyze 3.1 ms
generate 0.1 ms
compile 34.1 ms
total build 61.4 ms
➜ nelua-lang git:(master ✓) sync; sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
➜ nelua-lang git:(master ✓) nelua -tb --no-cache examples/helloworld.nelua
startup 132.1 ms
parse 5.6 ms
preprocess 0.1 ms
analyze 12.0 ms
generate 0.5 ms
compile 134.9 ms
total build 285.1 ms
➜ nelua-lang git:(master ✓) nelua -tb --no-cache examples/helloworld.nelua
startup 22.2 ms
parse 1.5 ms
preprocess 0.0 ms
analyze 3.3 ms
generate 0.1 ms
compile 34.7 ms
total build 61.8 ms Notice that after dropping the OS cache Nelua takes about 4x time to compile. When the OS decides to drop caches I can't say, this vary between setups, environment and activity, this is something specific to your OS and out of the scope here. You could use high speed hard disk or even put Nelua and all its files in RAM memory to speedup. |
Beta Was this translation helpful? Give feedback.
The compiler startup just load lua files, and check some disk files. What you are experience is probably something related to your OS, when you delete the folder probably the OS is invalidating files cache and when you startup again the OS need to recache the files. You could confirm this executing the following:
sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
For instance once the OS cache Nelua files, the startup takes about 20ms here, but when I drop the caches it takes more than 100ms: