deduplicating lambda methods
B. Blaser
bsrbnd at gmail.com
Fri Mar 30 13:12:01 UTC 2018
On 27 March 2018 at 19:33, Vicente Romero <vicente.romero at oracle.com> wrote:
>
>
> On 03/27/2018 12:58 PM, Brian Goetz wrote:
>>
>> It looks like there were no changes in the outcome, perhaps because there
>> were no within-file duplications in the JDK. (Which I believe.) A more
>> streams/Rx/CompletableFuture-heavy codebase would likely see an improvement.
>
>
> right, no difference :(, let's see what happens with Liam's numbers :)
>
> Vicente
I perhaps found at least one trivial lambda duplicate in the JDK (javac) here:
http://hg.openjdk.java.net/jdk/jdk/file/814bd31f8da0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#l450
I tried to reproduce it like this (is that right?):
import java.util.List;
import java.util.Set;
public class Test {
class CaputureScanner extends SimpleVisitor {
public Void visitClassType(Type.ClassType t, Set<Type> seen) {
if ( t.isCompound() ) {
directSupertypes(t).forEach(s -> visit(s, seen));
} else {
t.allparams().forEach(ta -> visit(ta, seen));
}
return null;
}
}
public static class SimpleVisitor {
public Void visit(Type t, Set<Type> seen) { return null; }
}
public static class Type {
public boolean isCompound() { return false; }
public static class ClassType extends Type {
public List<Type> allparams() { return null; }
}
}
public List<Type> directSupertypes(Type t) { return null; }
}
which is correctly de-duplicated.
But stats don't show any difference, are they missing something?
Bernard
More information about the amber-dev
mailing list