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

Code changed during plunch #1320

Merged
merged 2 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions base/src/test/java/org/aya/tyck/TyckTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,21 @@ public void issue768() {
var seed = 114514L;
var random = new Random(seed);
var largeList = mkList.apply(ImmutableIntSeq.fill(50, () -> random.nextInt(400)));
var args = ImmutableSeq.of(largeList);
var term = new FnCall(tree_sortNat, 0, ImmutableSeq.of(largeList));

var normalizer = new Normalizer(new TyckState(result.info().shapeFactory(), new PrimFactory()));
var sortResult = new Object() {
Term t;
};
var deltaTime = TimeUtil.profile(() -> sortResult.t = normalizer
.normalize(new FnCall(tree_sortNat, 0, args), NormalizeMode.FULL));
.normalize(term, NormalizeMode.FULL));
assertNotNull(sortResult.t);

System.out.println("Done in " + TimeUtil.millisToString(deltaTime));
System.out.println(sortResult.t.easyToString());

TimeUtil.profileMany("Running many times on the same input...", 5, () ->
normalizer.normalize(new FnCall(tree_sortNat, 0, args), NormalizeMode.FULL));
TimeUtil.profileMany("Running many times on the same input...", 10, () ->
normalizer.normalize(term, NormalizeMode.FULL));
}

public record TyckResult(@NotNull ImmutableSeq<TyckDef> defs, @NotNull ResolveInfo info) {
Expand Down
5 changes: 3 additions & 2 deletions jit-compiler/src/test/java/RedBlackTreeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public class RedBlackTreeTest {
stream.close();
var result = CompileTest.tyck(code);
var baseDir = CompileTest.GEN_DIR.resolve("redblack");
TimeUtil.profileMany("Code generation", 1, () -> CompileTest.serializeFrom(result, baseDir));
var time = TimeUtil.profile(() -> CompileTest.serializeFrom(result, baseDir));
System.out.println("Code generation time: " + TimeUtil.millisToString(time));
var innerLoader = new URLClassLoader(new URL[]{baseDir.toUri().toURL()}, RedBlackTreeTest.class.getClassLoader());
InstanceLoader tester = new InstanceLoader(innerLoader);

Expand Down Expand Up @@ -68,7 +69,7 @@ private static Term mkList(ImmutableIntSeq xs) {
assertNotNull(term);
System.out.println(term.easyToString());

TimeUtil.profileMany("Running many times on the same input...", 5, () ->
TimeUtil.profileMany("Running many times on the same input...", 10, () ->
tree_sortNat.invoke(args));
}

Expand Down
Loading