Skip to content

[Mono AOT] Improve build time on Apple mobile #110833

Closed
@kotlarmilos

Description

@kotlarmilos

Description

The build time for Apple mobile apps has significantly regressed in .NET 9: #110406.

Simple perf tests #110406 (comment) using the MAUI iOS template app on a macOS-arm64 host with an ios-arm64 target indicate a clear performance regression in the Mono AOT compiler:

Mono AOT .NET 8 SDK .NET 9 SDK
NET 8 44.837s 46.303s
NET 9 66s 108.209s

A sample profiling run indicates dn_simdhash_ght_try_get_value hotspot within the Mono AOT compilation:

Total number in stack (recursive counted multiple, when >=5):
        1713       dn_simdhash_ght_try_get_value  (in mono-aot-cross) + 208  [0x10001ec9c]  dn-simdhash-specialization.h:482
        1662       mono_metadata_get_generic_inst  (in mono-aot-cross) + 460  [0x100196194]  metadata.c:3467
        1651       mono_metadata_get_canonical_generic_inst  (in mono-aot-cross) + 212  [0x100196324]  metadata.c:3502
        1548       dn_simdhash_ght_equals  (in mono-aot-cross) + 72  [0x100020c60]  dn-simdhash-ght-compatible.c:35
        1488       dn_simdhash_ght_try_get_value_with_hash  (in mono-aot-cross) + 1020  [0x10001f0a8]  dn-simdhash-specialization.h:490
        1487       mono_metadata_generic_inst_equal  (in mono-aot-cross) + 52  [0x100193384]  metadata.c:1922
        1294       mono_metadata_inflate_generic_inst  (in mono-aot-cross) + 276  [0x1001970d4]  metadata.c:3661
        1227       mono_generic_inst_equal_full  (in mono-aot-cross) + 348  [0x1001934ec]  metadata.c:1910
        1181       dn_simdhash_ght_try_get_value_with_hash  (in mono-aot-cross) + 0  [0x10001ecac]  dn-simdhash-specialization.h:490
        1090       do_mono_metadata_type_equal  (in mono-aot-cross) + 0  [0x10019bac0]  metadata.c:5854


Sort by top of stack, same collapsed (when >= 5):
        __psynch_cvwait  (in libsystem_kernel.dylib)        213507
        mono_generic_inst_equal_full  (in mono-aot-cross)        56454
        do_mono_metadata_type_equal  (in mono-aot-cross)        42611
        dn_simdhash_ght_try_get_value_with_hash  (in mono-aot-cross)        30071
        mono_metadata_generic_param_equal_internal  (in mono-aot-cross)        17027
        dn_simdhash_ght_equals  (in mono-aot-cross)        8150
        mono_metadata_generic_inst_equal  (in mono-aot-cross)        7983
        m_type_data_get_generic_param  (in mono-aot-cross)        5280
        mono_local_regalloc  (in mono-aot-cross)        2434
        m_type_data_get_generic_param_unchecked  (in mono-aot-cross)        2118

Tasks

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions