forked from DenWav/primeiron
-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
707 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'net.minecraftforge.licenser' | ||
} | ||
|
||
configurations { | ||
jmhOnly | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
java { | ||
toolchain.languageVersion = JavaLanguageVersion.of(8) | ||
withSourcesJar() | ||
} | ||
|
||
license { | ||
header = rootProject.file("LICENSE-header.txt") | ||
newLine = false | ||
} | ||
|
||
dependencies { | ||
implementation rootProject | ||
implementation libs.jmh.core | ||
implementation libs.asm | ||
|
||
jmhOnly sourceSets.main.output | ||
jmhOnly libs.bundles.jmh | ||
|
||
annotationProcessor libs.jmh.generator.annprocess | ||
} | ||
|
||
tasks.register('jmh', JavaExec) { | ||
dependsOn rootProject.tasks.named('build') | ||
dependsOn sourceSets.main.output | ||
|
||
javaLauncher.set(javaToolchains.launcherFor { | ||
languageVersion = JavaLanguageVersion.of(17) | ||
}) | ||
jvmArgs = [ | ||
'-p', sourceSets.main.runtimeClasspath.asPath, | ||
'--add-modules', 'ALL-MODULE-PATH', | ||
] | ||
classpath = files(configurations.jmhOnly.asPath) | ||
mainClass = 'org.openjdk.jmh.Main' | ||
|
||
args '-bm', 'avgt' // benchmark mode | ||
args '-r', '5s' // iteration time | ||
args '-w', '5s' // warmup time | ||
args '-wi', '2' // warmup iterations | ||
|
||
// profilers | ||
//args '-prof', 'stack' | ||
args '-prof', "jfr:dir=${project.layout.buildDirectory.asFile.get()}/jfr" | ||
|
||
args '-tu', 'us' // time unit | ||
args '-i', '2' // iterations | ||
args '-f', '1' // forks | ||
args '-rff', project.file("${rootProject.layout.buildDirectory.asFile.get()}/jmh_results.txt") // results file | ||
args 'net.minecraftforge.accesstransformer.benchmarks.AccessTransformerListBenchmark' | ||
} |
47 changes: 47 additions & 0 deletions
47
.../java/net/minecraftforge/accesstransformer/benchmarks/AccessTransformerListBenchmark.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) Forge Development LLC | ||
* SPDX-License-Identifier: LGPL-2.1-only | ||
*/ | ||
package net.minecraftforge.accesstransformer.benchmarks; | ||
|
||
import net.minecraftforge.accesstransformer.parser.AccessTransformerList; | ||
import org.openjdk.jmh.annotations.Benchmark; | ||
import org.openjdk.jmh.annotations.Scope; | ||
import org.openjdk.jmh.annotations.Setup; | ||
import org.openjdk.jmh.annotations.State; | ||
import org.openjdk.jmh.infra.Blackhole; | ||
import org.objectweb.asm.Type; | ||
|
||
@State(Scope.Benchmark) | ||
public class AccessTransformerListBenchmark { | ||
private AccessTransformerList staticList; | ||
|
||
@Setup | ||
public void setup() throws Exception { | ||
staticList = new AccessTransformerList(); | ||
staticList.loadFromResource("accesstransformer_forge_119.cfg"); | ||
staticList.loadFromResource("accesstransformer_firstaid_119.cfg"); | ||
staticList.loadFromResource("accesstransformer_jei_119.cfg"); | ||
} | ||
|
||
@Benchmark | ||
public void testATLoad(Blackhole blackhole) throws Exception { | ||
AccessTransformerList list = new AccessTransformerList(); | ||
list.loadFromResource("accesstransformer_forge_119.cfg"); | ||
list.loadFromResource("accesstransformer_firstaid_119.cfg"); | ||
list.loadFromResource("accesstransformer_jei_119.cfg"); | ||
blackhole.consume(list); | ||
} | ||
|
||
@Benchmark | ||
public void testAtContainsMiss(Blackhole blackhole) throws Exception { | ||
if (staticList.containsClassTarget(Type.getObjectType("net/minecraft/client/gui/font/FontManager"))) | ||
throw new RuntimeException("Didn't expect to find FontManager!"); | ||
} | ||
|
||
@Benchmark | ||
public void testAtContainsHit(Blackhole blackhole) throws Exception { | ||
if (!staticList.containsClassTarget(Type.getObjectType("net/minecraft/client/gui/Gui"))) | ||
throw new RuntimeException("Expected to find Gui!"); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
at-jmh/src/main/resources/accesstransformer_firstaid_119.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
public net.minecraft.client.gui.Gui f_92976_ # healthUpdateCounter | ||
|
||
public-f net.minecraft.world.entity.Entity f_19804_ # dataManager | ||
|
||
public net.minecraft.server.level.ServerLevel f_8550_ # allPlayersSleeping | ||
|
||
public net.minecraft.world.entity.LivingEntity m_21262_(Lnet/minecraft/world/damagesource/DamageSource;)Z # checkTotemDeathProtection | ||
public net.minecraft.world.entity.LivingEntity f_20961_ # HEALTH | ||
|
||
public net.minecraft.world.entity.player.Player f_36107_ # ABSORPTION | ||
|
||
public net.minecraft.network.syncher.SynchedEntityData m_135375_(Lnet/minecraft/network/syncher/SynchedEntityData$DataItem;Lnet/minecraft/network/syncher/SynchedEntityData$DataItem;)V # setEntryValue | ||
public net.minecraft.network.syncher.SynchedEntityData m_135379_(Lnet/minecraft/network/syncher/EntityDataAccessor;)Lnet/minecraft/network/syncher/SynchedEntityData$DataItem; # getEntry | ||
|
||
public net.minecraft.world.item.enchantment.EnchantmentHelper m_44850_(Lnet/minecraft/world/item/enchantment/EnchantmentHelper$EnchantmentVisitor;Lnet/minecraft/world/item/ItemStack;)V # runIterationOnItem | ||
public net.minecraft.world.item.enchantment.EnchantmentHelper$EnchantmentVisitor | ||
|
||
# For FirstaidIngameGui | ||
public net.minecraft.client.gui.Gui f_92989_ #tickCount | ||
public net.minecraft.client.gui.Gui f_92973_ #lastHealth | ||
public net.minecraft.client.gui.Gui f_92975_ #lastHealthTime | ||
public net.minecraft.client.gui.Gui f_92974_ #displayHealth | ||
public net.minecraft.client.gui.Gui f_92985_ #random |
Oops, something went wrong.