Skip to content

Make Fantomas AOT compatible #3084

Open
@TobyShaw

Description

@TobyShaw

Using fantomas to format a single file via the command line is very slow, ~700-1000ms depending on the size of the file.

I hypothesised that this was due to the JIT taking time to warm up (not an issue with fantomas --daemon or formatting many files). In a test, I got fantomas to compile with AOT enabled, and was able to reduce the time to ~70-100ms, a legitimate 10x speedup.

The changes required are:

  • Upgrade to net8.0
  • Remove Argu (or swap to a non-Quotation-based interface)
  • Remove $"%A{..}" style string building in ASTTransformer
  • Sprinkle some msbuild properties

It's not obvious how an AOT executable is distributed as a dotnet tool, I'd be happy enough if building/packaging/deploying the AOT fantomas was left as an exercise for power users.

Would any of the changes I suggested be accepted? If we do need to fork fantomas for this change, ideally we keep our diff as small as possible.

Please tick all that apply:

  • This is not a breaking change to Fantomas
  • I or my company would be willing to help implement and/or test this
  • This suggestion is part of the Microsoft style guide (please add a link to section if so)
  • This suggestion is part of the G-Research style guide (please add a link to section if so)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions