Skip to content

PreferredConstructor.isConstructorParameter(…) on hot code paths creates a lot of allocations #2295

Closed
@lucaspouzac

Description

@lucaspouzac

Hello,

I think it would be interesting to also cache in the case where the persistentproperty is not used by the constructor, in order to avoid the creation of an iterator, in particular rather expensive during large list.

public boolean isConstructorParameter(PersistentProperty<?> property) {

	public boolean isConstructorParameter(PersistentProperty<?> property) {
...
		for (Parameter<?, P> parameter : parameters) {
			if (parameter.maps(property)) {
				isPropertyParameterCache.put(property, true);
				return true;
			}
		}

		isPropertyParameterCache.put(property, false);
		return false;
	}

image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions