Cloud Computing 10 min read

Performance Evaluation of Dart Compilation Modes for Server‑Side FaaS Applications

Evaluating Dart’s AoT, AppJIT, Kernel, and JIT compilation for server‑side FaaS shows AoT yields the fastest runtime (≈6× JIT), AppJIT with aggressive optimization slightly outperforms Kernel, startup latency rivals Java, and for long‑running services JIT modes with tuning provide comparable throughput while minimizing build time.

Xianyu Technology
Xianyu Technology
Xianyu Technology
Performance Evaluation of Dart Compilation Modes for Server‑Side FaaS Applications

The article investigates how different Dart compilation strategies (AoT, AppJIT, Kernel, and JIT) affect startup speed and runtime performance for server‑side Function‑as‑a‑Service (FaaS) containers.

Short‑lived application test : An empty Dart function (EmptyMain) is compiled to an app‑JIT snapshot using the command:

dart snapshot-kind=app-jit snapshot=empty_main.snapshot empty_main.dart

Results show Dart’s startup speed comparable to Java, while C runs ~20× faster due to the lack of a runtime. AppJIT slightly outperforms Kernel.

Fibonacci benchmark : Recursive Fibonacci(50) is implemented in C, Java, and Dart. The Dart versions are compiled with various options:

#2. Execute aggressive optimization
dart --no-background-compilation \
    --optimization-counter-threshold=1 \
    --snapshot-kind=app-jit \
    --snapshot=fibonacci.snapshot fibonacci.dart
#3. Generate Kernel snapshot
dart --snapshot=fibonacci.snapshot fibonacci.dart
#4. AoT compilation
pkg/vm/tools/precompiler2 fibonacci.dart fibonacci.aot

Key findings:

AoT delivers the highest performance (≈6× faster than JIT).

AppJIT with aggressive optimization is marginally better than Kernel.

Dart JIT is ~25% slower than HotSpot JVM in the same workload.

Compiler tuning : Adjusting recursive inlining depth improves Dart JIT performance:

dart --inlining_recursion_depth_threshold=5 fibonacci.snapshot 50

Similar JVM tuning is performed with -XX:MaxRecursiveInlineLevel=5 .

Long‑lived application test : A simple Dart HttpServer handling JSON serialization is evaluated under Source, Kernel, and AppJIT modes. Commands include:

dart --snapshot=server.snapshot http_server.dart

All three modes converge to similar steady‑state throughput after warm‑up; compilation cost becomes negligible. AppJIT reaches peak performance faster than Kernel, while Source mode incurs a longer VM start‑up delay.

FaaS container build : Measuring the time to produce snapshots for a real FaaS tool shows that AoT dramatically reduces build time, satisfying the need for rapid deployment.

Conclusions and recommendations :

Use AoT for compilation‑cost‑dominated workloads.

For long‑running services, prefer JIT (AppJIT or Kernel) with optimizer enabled.

AppJIT shortens warm‑up time and is suitable for high‑concurrency scaling.

Further VM tuning (e.g., new‑gen size, isolate settings) can reduce GC pauses.

DartFaaSPerformanceCompilationJITAOT
Xianyu Technology
Written by

Xianyu Technology

Official account of the Xianyu technology team

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.