Considering -
The file encoding,
The file size,
Inner data structure,
Startup time and etc.
And what is the main reason to choose dill file to start dart application? Which one has better startup time performance? And why?
Considering -
The file encoding,
The file size,
Inner data structure,
Startup time and etc.
And what is the main reason to choose dill file to start dart application? Which one has better startup time performance? And why?
https://mrale.ph/dartvm/ is a great summary from a long-time Dart language team member.
As I understand it dill files and kernel snapshot are the same thing. dill
is just the name for the file extension used for Kernel (AoT snapshots)
Since Dart 2 VM no longer has the ability to directly execute Dart from raw source, instead VM expects to be given Kernel binaries (also called dill files) which contain serialized Kernel ASTs. snapshot
I assume what you actually want to know is the difference between AoT and JiT snapshots.
Initially snapshots did not include machine code, however this capability was later added when AOT compiler was developed. Motivation for developing AOT compiler and snapshots-with-code was to allow VM to be used on the platforms where JITing is impossible due to platform level restrictions.
Snapshots-with-code work almost in the same way as normal snapshots with a minor difference: they include a code section which unlike the rest of the snapshot does not require deserialization. This code section laid in way that allows it to directly become part of the heap after it was mapped into memory.
Startup time
AppJIT snapshots were introduced to reduce JIT warm up time for large Dart applications like dartanalyzer or dart2js. When these tools are used on small projects they spent as much time doing actual work as VM spends JIT compiling these apps.
So the main reason to use JiT is because AoT is not allowed (mainly iOS) or for short-lived commands where continual optimization based on code usage (hot-spot) would unlikely lead to any results.
For a discussion about the size see also https://github.com/dart-lang/sdk/issues/28655#issuecomment-428370886