Skip to content

Severe performance slowdown on Intel Mac when running DeOldify with .NET 9 Mac Catalyst (UseInterpreter=true required) #36

Description

@hirendmindfire

Environment:

.NET 9

.NET MAUI / Mac Catalyst

macOS 13+

Intel Mac (x86_64)

DeOldify C# inference code (unsafe + tensor operations)

AOT/JIT disabled when using UseInterpreter=true

Problem Description:

When running the DeOldify class library on Intel-based macOS using .NET 9 Mac Catalyst, the application becomes extremely slow unless I enable:

true

If I remove this or set it to false, the app crashes on startup with no usable stack trace.
Because of this, DeOldify tensor operations and unsafe blocks are running under the interpreter, which results in massive performance degradation on Intel Macs.

Expected Behavior:

App should not crash when false on Intel Mac

Unsafe/tensor heavy workloads should execute with normal performance (JIT/AOT) instead of interpreter-only mode

Actual Behavior:

App crashes unless interpreter is forced

When interpreter is used:

Unsafe code paths become 10×–20× slower

Tensor operations in DeOldify (PixelShuffle, UpSample, Conv2d blocks) take much longer

UI freezes during image processing

What I Tried:

Adding Unsafe blocks with /unsafe

Adding [MethodImpl(MethodImplOptions.NoOptimization | NoInlining)]

Using -all,MyNamespace

Testing on both macOS 13 and macOS 14

Testing both Intel and ARM (ARM works fine)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions