Skip to content
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

Try using gumtree-simple matcher in Spork instead of gumtree-classic #493

Open
jrfaller opened this issue Feb 5, 2024 · 6 comments
Open

Comments

@jrfaller
Copy link

jrfaller commented Feb 5, 2024

Since GumTree's version 3.0 we have a new faster and more accurate matcher, called gumtree-simple. I think it could be a nice thing to try using it inside Spork instead of gumtree-classic as the base matcher and perhaps also the left-right matcher? I am not sure where in the code the matchers are instantiated, but I think it should be easy to do.

WDYT?

Cheers!

@monperrus
Copy link
Collaborator

monperrus commented Feb 7, 2024 via email

@jrfaller
Copy link
Author

jrfaller commented Feb 7, 2024

OK found the code here -> https://github.com/ASSERT-KTH/spork/blob/master/src/main/kotlin/se/kth/spork/spoon/Spoon3dmMerge.kt#L355-L365 therefore I can easily make a patch to update to gumtree-simple. However, it would be nice to know whether or not it improves merging time and/or textual similarity to the gold set compared to using classic and XY. Do you have any idea how to do that?

@slarse
Copy link
Collaborator

slarse commented Feb 7, 2024

Hey @jrfaller,

That's an interesting idea. Swapping out left/right matcher is almost guaranteed to cause trouble failures as everything is very finely tuned for the X/Y matcher. I chose the X/Y matcher because it was less prone to spurious left/right matchings (which cause massive trouble). The default matcher caused way too many spurious matchings and was very impractical to use for that.

The base matcher might be OK to swap out, but it also depends on how Gumtree-Spoon has changed since Spork was created. Spork makes heavy use of Gumtree-Spoon's internal behavior, I think the most blatant example of this is where it infers additional mappings (see

private fun inferAdditionalMappings(matches: List<Pair<CtElement, CtElement>>) {
var mutableMatches = matches
while (mutableMatches.isNotEmpty()) {
val newMatches: MutableList<Pair<CtElement, CtElement>> = ArrayList()
for (match in mutableMatches) {
val src = match.first
val dst = match.second
newMatches.addAll(inferAdditionalMappings(src, dst))
}
mutableMatches = newMatches
}
}
).

The benchmark suite should be viable to do some quick and dirty evaluations. The latest version is in the replication package (download https://github.com/ASSERT-KTH/spork/releases/download/v0.5.1/replication_package.tar.gz, the benchmark suite is in replication_package/software/benchmark-scripts, README explains from there). I'm not sure why I never checked that into the repository.

There's also a very outdated version of the benchmark suite that for reasons along the lines of "I never got around to it" still runs in CI, see e.g. https://github.com/ASSERT-KTH/spork/actions/runs/7715093311/job/21028824279. But I would go with the one in the replication package.

For a comprehensive evaluation I think just running the experiments again would be the least hands-on thing to do (see https://github.com/ASSERT-KTH/spork/tree/master/replication#setting-up-for-the-experiments).

@monperrus
Copy link
Collaborator

OK found the code here -> master/src/main/kotlin/se/kth/spork/spoon/Spoon3dmMerge.kt#L355-L365 therefore I can easily make a patch to update to gumtree-simple

give it a try @jrfaller !

@jrfaller
Copy link
Author

OK I am preparing a pull request, we will see how to run a benchmark to see whether or not it is useful! Cheers!

@jrfaller
Copy link
Author

Started the WIP in #534 you can take a look

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

No branches or pull requests

3 participants