Skip to content

perf: make anyForSubtypeOf cacheable #634

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vlsi
Copy link
Contributor

@vlsi vlsi commented May 11, 2025

Overview

This is a prototype that might resolve #624

Details

It turns out kotlinc inserts "sam wrappers" when converting Kotlin lambdas into Java functional interfaces. The sam wrappers do not have equals/hashCode, so it defeats jqwik's caching.

The fix is to move out .flatMap { ... } out of inline function, so kotlinc no longer adds sam wrappers.

TODO:

  • DefaultTypeArbitrary.equals should account for traverseArbitrary.enableRecursion somehow
  • net.jqwik.kotlin.api.SubtypeScope#hashCode does not seem to trigger when executing AnyForSubtypeOfTests. I guess it should somehow
  • I haven't actually compared the performance for anyForSubtypeOf

I hereby agree to the terms of the jqwik Contributor Agreement.

@jlink
Copy link
Collaborator

jlink commented Jul 11, 2025

Currently not working on it. See Status: Maintenance Mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performances degradataion in 1.9.0
2 participants