Skip to content

Extremely slow compilation using mapstruct 1.5.5 with Java 17 #3435

@sween5

Description

@sween5

Project build on Java 17 with mapstruct is extremely slow.
Project is around 1730 classes including arond 250 mappers. On java 17 the whole project builds in 10 minutes on mine development machine under Windows 11 (amd ryzen 5 5600H laptop, 16gb ram). Unfortunately with each mapper that I add the time increases significantly. I've sampled CPU usage with VisualVM and attached screenshot for reference. It seem like the main culprit for performance regression is org.mapstruct.ap.internal.processor.MapperCreationProcessor.getMappingMethods (), but I'm not familiar with this subject enough to solve problem myself.
image

I'm guessing it's about mapping properties between source and target objects and I'm currently trying to reduce the number of methods from each mapper.
I have a generic Basemapper interface where I have 4 methods: toDto, toEntity, toDto(List), toEntity (List). Each mapper extends this base mapper. I also have a second generic interface for generating the update method from dto to entity, and I'm using it across around 40 mappers, where I need updates.
Almost every mapper uses other mappers to inherit the toDto, toEntity, update methods.
Any ideas how to improve it? Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions