gpt4 book ai didi

dart - 在dartlang中,莳萝和内核快照之间有什么区别?

转载 作者:行者123 更新时间:2023-12-03 02:53:13 26 4
gpt4 key购买 nike

考虑-
文件编码,
文件大小
内部数据结构,
启动时间等

选择莳萝文件启动dart应用程序的主要原因是什么?
哪一个具有更好的启动时间性能?又为什么呢

最佳答案

https://mrale.ph/dartvm/是Dart语言团队长期成员的精彩总结。

据我了解,莳萝文件和内核快照是同一回事。 dill只是用于内核(AoT快照)的文件扩展名。

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



我假设您真正想知道的是AoT和JiT快照之间的区别。

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.



启动时间

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.



因此,使用JiT的主要原因是因为不允许使用AoT(主要是iOS)
或短命命令,其中基于代码使用情况(热点)的持续优化不太可能导致任何结果。

有关大小的讨论,请参见 https://github.com/dart-lang/sdk/issues/28655#issuecomment-428370886

关于dart - 在dartlang中,莳萝和内核快照之间有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55116107/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com