Skip to content

[vm/ffi] Enable inlining idempotent force-optimized functions #38985

@dcharkes

Description

@dcharkes

The dart:ffi memory operations are on par with dart:typed_data in AoT, but roughly 4x slower in JiT on x64/ia32/arm64/arm.

To get JiT in line, the indexed load/store should be made inlineable in unoptimized code. This is possible, even with code motion, because the index load/store are idempotent operations.

x64 measurements:

$ dart benchmarks/FfiMemory/dart/FfiMemory.dart 
FfiMemory.PointerInt8(RunTime): 72.17852760736196 us.

$ dart ../../golem/golem4/benchmarks/TypedData/dart/TypedData.dart 
TypedData.Int8ListBench(RunTime): 15.412078084904714 us.

$ DART_CONFIGURATION=ReleaseX64 pkg/vm/tool/precompiler2 benchmarks/FfiMemory/dart/FfiMemory.dart bench.dill
$ DART_CONFIGURATION=ReleaseX64 pkg/vm/tool/dart_precompiled_runtime2 bench.dill
FfiMemory.PointerInt8(RunTime): 19.55705275509705 us.

$ DART_CONFIGURATION=ReleaseX64 pkg/vm/tool/precompiler2 ../../golem/golem4/benchmarks/TypedData/dart/TypedData.dart bench.dill
$ DART_CONFIGURATION=ReleaseX64 pkg/vm/tool/dart_precompiled_runtime2 bench.dill
TypedData.Int8ListBench(RunTime): 19.509307113036012 us.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.type-performanceIssue relates to performance or code size

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions