From 8e4f31bd89da816bd14b9c866769aee39029f282 Mon Sep 17 00:00:00 2001 From: Zachary <91168951+zacharyk812@users.noreply.github.com> Date: Tue, 24 Nov 2026 15:54:47 -0600 Subject: [PATCH] perf(core): startup under budget, with Paper's loader and the startup classes loaded ahead On Paper and Folia from 1.19.3 the jar is also a Paper plugin whose loader (core-loader's PaperLibraryLoader) hands Paper the libraries from the family's cache, skipping Maven's resolver and the legacy class rewriting at every boot. The classes a plugin loads as it starts are recorded on a real server (check.sh --record-startup), mapped to R8's names at build time and loaded by the shim's preload thread before onEnable. xSample on Paper 1.21.11: 252.6 ms to 59.5 ms; on 26.3: 193.9 ms to 39.0 ms. The budgets job fails on startup again. --- .github/workflows/boot.yml | 11 +- DECISIONS.md | 20 + .../src/main/kotlin/XenaR8Extension.kt | 7 + .../kotlin/co/xenastudios/gradle/R8Shrink.kt | 69 +- .../src/main/kotlin/xena.r8.gradle.kts | 2 + core/core-loader/build.gradle.kts | 25 + .../core/loader/bukkit/BukkitBootstrap.java | 107 ++-- .../core/loader/bukkit/LoaderSettings.java | 54 ++ .../core/loader/paper/PaperLibraryLoader.java | 69 ++ .../sample/bukkit/build.gradle.kts | 2 +- .../src/main/resources/paper-plugin.yml | 11 + .../sample/bukkit/startup-classes.txt | 598 ++++++++++++++++++ gradle/perf-budgets.txt | 4 +- scripts/budgets/analyze.py | 13 +- scripts/budgets/check.sh | 24 +- scripts/budgets/startup_classes.py | 77 +++ 16 files changed, 1018 insertions(+), 75 deletions(-) create mode 100644 core/core-loader/src/main/java/co/xenastudios/core/loader/bukkit/LoaderSettings.java create mode 100644 core/core-loader/src/paper/java/co/xenastudios/core/loader/paper/PaperLibraryLoader.java create mode 100644 core/core-testing/sample/bukkit/src/main/resources/paper-plugin.yml create mode 100644 core/core-testing/sample/bukkit/startup-classes.txt create mode 100644 scripts/budgets/startup_classes.py diff --git a/.github/workflows/boot.yml b/.github/workflows/boot.yml index 3c36d365..8c8cb53a 100644 --- a/.github/workflows/boot.yml +++ b/.github/workflows/boot.yml @@ -345,9 +345,10 @@ jobs: # The runtime budgets (ROADMAP.md, "Fast, robust, light"; gradle/perf-budgets.txt) on Paper, # with xSample's R8 jar: scripts/budgets/check.sh boots it 4 times for startup, then measures - # heap, metaspace and an idle profile with async-profiler. Over a budget fails the job, - # except startup, which is only reported (a warning in the job summary) until the plugins' - # packaging brings it under 150 ms: 271 ms on an M1 Pro today (DECISIONS.md, "Budgets"). + # heap, metaspace and an idle profile with async-profiler. Over any budget fails the job, + # startup's included: 60 ms on an M1 Pro on Paper 1.21.11, 39 ms on 26.3, with Paper handed + # the libraries by the core's loader and the startup classes loaded ahead (DECISIONS.md, + # "Startup under budget"). # Per pull request on the newest Paper without players, a few minutes beside the boots; # nightly and by hand also the BotMark load, 10 mineflayer bots for a minute, on Paper # 1.21.11, the newest Minecraft mineflayer speaks and the version M0 measured. @@ -389,14 +390,14 @@ jobs: run: | newest=$(sed -n 's/^xena\.ciNewestMinecraft=//p' gradle.properties) scripts/budgets/check.sh --version "$newest" --java "$JAVA_HOME_25_X64" --bots 0 --idle 30 --settle 15 \ - --report-only startup-first-ms,startup-ms --out build/budgets/newest \ + --out build/budgets/newest \ core/core-testing/sample/bukkit/build/r8/XSample.jar - name: BotMark load (Paper 1.21.11, 10 bots) if: github.event_name != 'pull_request' run: | scripts/budgets/check.sh --version 1.21.11 --java "$JAVA_HOME_21_X64" --bots 10 \ --commands "xsample,coins,pay {other} 1" \ - --report-only startup-first-ms,startup-ms --out build/budgets/botmark \ + --out build/budgets/botmark \ core/core-testing/sample/bukkit/build/r8/XSample.jar - if: always() uses: actions/upload-artifact@v7 diff --git a/DECISIONS.md b/DECISIONS.md index fae35514..aeaf1f92 100644 --- a/DECISIONS.md +++ b/DECISIONS.md @@ -60,6 +60,7 @@ Why the plugins are built the way they are, oldest first. | [The update checker and bStats in the rewrite's core: Modrinth's version types as channels, bStats on Bukkit only](#the-update-checker-and-bstats-in-the-rewrites-core-modrinths-version-types-as-channels-bstats-on-bukkit-only-2026-11-24) | 2026-11-24 | | [Fabric jars relocate their core: one convention, relocation then R8 then Loom](#fabric-jars-relocate-their-core-one-convention-relocation-then-r8-then-loom-2026-11-24) | 2026-11-24 | | [A real client in the boot tests: one mineflayer bot on Spigot 1.8.8 and Paper 1.21.11](#a-real-client-in-the-boot-tests-one-mineflayer-bot-on-spigot-188-and-paper-12111-2026-11-24) | 2026-11-24 | +| [Startup under budget: Paper gets the libraries from our loader, and the startup classes load ahead](#startup-under-budget-paper-gets-the-libraries-from-our-loader-and-the-startup-classes-load-ahead-2026-11-24) | 2026-11-24 | ## One minimum version: Paper 1.21.11, Java 21 (2026-10-21) @@ -713,3 +714,22 @@ Until now no client had joined a boot test, so messages to players, joins and qu - **Where it runs:** a new per-PR cell, Paper 1.21.11 (the newest Minecraft mineflayer 4.39 speaks; CI's newest Paper is 26.3), and the Spigot 1.8.8 cell, both with `client: true`, which adds Node.js and the bots' cache and the client checks to the cell's boot. Locally the client added about 15 s to a boot (22 s for the whole Spigot 1.8.8 boot, about 30 s for Paper with its paused boot), well under the two minutes a per-PR check may cost, so it isn't nightly-only. - **Passed locally:** Paper 1.21.11 (Java 21) and Spigot 1.8.8 (Java 8), every check on both. - **Not yet:** a client on Fabric (mineflayer could join a Fabric server, which needs nothing on the client), the client command tree after a reload (`updateCommands`, which DECISIONS' commands entry still wants confirmed), and Folia, where mineflayer's 26.x support is what's missing. + +## Startup under budget: Paper gets the libraries from our loader, and the startup classes load ahead (2026-11-24) + +The first plugin's startup was 271 ms against its 150 ms budget (282 on CI), the `budgets` job's one warning (#162). Both fixes the budgets entry above listed are in, and startup fails the job again when over. + +| xSample on an M1 Pro, `scripts/budgets/check.sh`, median of 3 boots | Server's part | onLoad | onEnable | Total | +|---|--:|--:|--:|--:| +| Paper 1.21.11 (Java 21), before | 96 | 20.1 | 138.3 | **252.6 ms** | +| Paper 1.21.11, with `paper-plugin.yml` and its loader | 10 | 15.3 | 112.5 | 137.4 ms | +| Paper 1.21.11, and the startup classes loaded ahead | 10 | 15.3 | 34.5 | **59.5 ms** | +| Paper 26.3 (Java 25), before | 78 | 17.7 | 97.5 | **193.9 ms** | +| Paper 26.3, after both | 4 | 4.3 | 30.2 | **39.0 ms** | + +- **On Paper, the jar is also a Paper plugin, whose loader hands Paper the libraries.** The jar carries a `paper-plugin.yml` beside its `plugin.yml`; Paper and Folia from 1.19.3 read it, and Spigot and older Paper never look at it. Its `loader` is the core's `PaperLibraryLoader` (core-loader's `paper` source set, Java 17 class files against Paper's API, never shipped with it), which takes each library in `META-INF/xena/libraries.txt` from the family's cache (`plugins/Xena/libraries/`, downloaded and checked against its pin as the shim does below 1.16.5) and gives it to Paper as a `JarLibrary`. That skips Maven's resolver, which Paper ran over `libraries:` at every boot (about 50 ms of CPU, mostly the resolver's own cold code, the same for one library or five), and Paper's legacy-plugin rewriting of every class (Commodore, and the reflection remapper for `libraries:`), which was a third of onEnable. Today's plugins were Paper plugins already, so this is their model, and the API rules hold: a `plugin.yml` plugin with `depend`, or a Paper plugin with `join-classpath`, sees a Paper plugin's API classes (checked in M1, `sandbox/paper-consumer`). Not chosen: the shim injecting the libraries itself on Paper, which needs the JDK's trusted lookup through `sun.misc.Unsafe` and prints the JDK's warning from Java 24, the Java Paper 26 runs on. +- **The classes a plugin needs as it starts are listed at build time and loaded ahead.** `scripts/budgets/check.sh --record-startup` logs a real boot's class loading (`-Xlog:class+load`) and writes the classes loaded before `Done` from the plugin's jar and its libraries (`startup_classes.py`), the jar's in their names before R8 (from its mapping). The project keeps that as `startup-classes.txt`; `shrinkJar` (R8Shrink) maps it to the shrunk jar's names and puts it in the jar as `META-INF/xena/startup-classes.txt`, leaving out classes R8 removed. The shim's preload thread, which loaded a hand list of the stdlib's biggest classes, now loads that list, without initializing anything, between onLoad and onEnable while the server prepares its worlds. xSample's list is 595 classes (299 of its own, the rest the stdlib's and the YAML parser's). A stale list only costs speed: a class it misses loads when first used, one it names that's gone is skipped. Record it again after a large change. +- **What "loads no classes" means now.** The list is recorded with the default config, so a module that's off by default is never in it. A module that's on by default and turned off by the owner still has its classes defined (not initialized: no static state, listeners or tasks), about what the recorded boot needed; ROADMAP.md's rule is about the runtime cost, which is still nothing. +- **What the number counts.** On Paper with `paper-plugin.yml` there's no `libraries:` line to time, so the loader logs its own time (`-Dxena.startupTimes=true`, through the shim's `Startup times` line: `loader 9.5 ms`), most of it hashing the cached jars against their pins. Paper making the plugin's class loader and loading its main class isn't in it: about 8 ms of CPU in a profile, which no log line bounds. Even counted, startup is under the 100 ms a plugin after the first gets. +- **The Boot workflow fails on startup again** (`--report-only` is gone from the `budgets` job). Booted after these changes: Paper 26.3 with the family test (xSample as a Paper plugin, xTwin with `plugin.yml`), Folia 26.3, and Spigot 1.8.8 on Java 8 with the family test, where the shim downloads the libraries and preloads the same list. +- **For each plugin:** a `paper-plugin.yml` naming `co.xenastudios..core.loader.paper.PaperLibraryLoader` (the relocated name; R8 keeps it, from the file), `api-version: '1.19'`, `folia-supported`, and the `dependencies` Paper plugins declare; and a recorded `startup-classes.txt` beside its build file. diff --git a/build-logic/src/main/kotlin/XenaR8Extension.kt b/build-logic/src/main/kotlin/XenaR8Extension.kt index 2cce41d7..e5a06e26 100644 --- a/build-logic/src/main/kotlin/XenaR8Extension.kt +++ b/build-logic/src/main/kotlin/XenaR8Extension.kt @@ -20,4 +20,11 @@ abstract class XenaR8Extension { /** The project's own keep rules, after the shared ones: the `.pro` files in its `r8` folder unless set. */ abstract val rules: ConfigurableFileCollection + + /** + * The classes the plugin loads as it starts, in their own names, for the shim to load ahead + * (R8Shrink): the project's `startup-classes.txt` if it has one. Record it with + * `scripts/budgets/check.sh --record-startup`. + */ + abstract val startupClasses: ConfigurableFileCollection } diff --git a/build-logic/src/main/kotlin/co/xenastudios/gradle/R8Shrink.kt b/build-logic/src/main/kotlin/co/xenastudios/gradle/R8Shrink.kt index 7df99f1f..06c05501 100644 --- a/build-logic/src/main/kotlin/co/xenastudios/gradle/R8Shrink.kt +++ b/build-logic/src/main/kotlin/co/xenastudios/gradle/R8Shrink.kt @@ -17,6 +17,7 @@ import org.gradle.api.tasks.CompileClasspath import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputFiles import org.gradle.api.tasks.Nested +import org.gradle.api.tasks.Optional import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.PathSensitive import org.gradle.api.tasks.PathSensitivity @@ -41,6 +42,12 @@ import org.gradle.process.ExecOperations * R8 carries the jar's other files over; Maven's pom files and Kotlin's `.kotlin_builtins` * (read only by kotlin-reflect) are then dropped. The mapping file stays with the build, for * stack traces (`retrace`). + * + * [startupClasses], when given, is the list of classes the plugin loads as it starts, in their + * own names (recorded on a real server by `scripts/budgets/check.sh --record-startup`): it goes + * into the jar as [STARTUP_CLASSES] in the names R8 gave them, for the shim to load on a thread + * of its own before the server enables the plugin. A class R8 removed, or that the jar no longer + * has, is left out; the list is a hint, so a missing class only loads when it's first used. */ @CacheableTask abstract class R8Shrink @Inject constructor(private val exec: ExecOperations) : DefaultTask() { @@ -76,6 +83,12 @@ abstract class R8Shrink @Inject constructor(private val exec: ExecOperations) : @get:OutputFile abstract val mapping: RegularFileProperty + /** The classes the plugin loads as it starts, one a line, in their own names: see the class's comment. */ + @get:InputFiles + @get:Optional + @get:PathSensitive(PathSensitivity.NONE) + abstract val startupClasses: ConfigurableFileCollection + /** The rules this task wrote from the jar, kept to read when a rule is missing. */ @get:OutputFile abstract val generatedRules: RegularFileProperty @@ -111,7 +124,7 @@ abstract class R8Shrink @Inject constructor(private val exec: ExecOperations) : } val out = outputJar.get().asFile out.parentFile.mkdirs() - copyWithout(classes, out) + copyWithout(classes, out, startupList(classes)) logger.lifecycle("%s: %.1f KiB -> %.1f KiB".format(out.name, input.length() / 1024.0, out.length() / 1024.0)) } @@ -150,21 +163,63 @@ abstract class R8Shrink @Inject constructor(private val exec: ExecOperations) : } } - private fun copyWithout(from: File, to: File) { + /** + * [startupClasses] in the shrunk jar's names, or `null` when there's no list. Classes of the + * jar's own (`co.xenastudios.`) must be in the shrunk jar; the rest are the libraries', the + * stdlib's, which R8 never sees, so they keep their names. + */ + private fun startupList(shrunk: File): String? { + val listed = startupClasses.files.filter { it.isFile } + if (listed.isEmpty()) return null + val renamed = HashMap() + mapping.get().asFile.forEachLine { line -> + if (!line.startsWith(" ") && !line.startsWith("#") && line.endsWith(":")) { + val (from, to) = line.removeSuffix(":").split(" -> ").takeIf { it.size == 2 } ?: return@forEachLine + renamed[from] = to + } + } + val present = ZipFile(shrunk).use { zip -> + zip.entries().asSequence().filter { it.name.endsWith(".class") } + .map { it.name.removeSuffix(".class").replace('/', '.') }.toHashSet() + } + val names = listed.flatMap { it.readLines() }.map { it.substringBefore('#').trim() }.filter { it.isNotEmpty() } + .mapNotNull { name -> + val now = renamed[name] ?: name + when { + now in present -> now + name.startsWith("co.xenastudios.") -> null + else -> now + } + } + .distinct() + logger.info("${outputJar.get().asFile.name}: ${names.size} startup classes") + return names.joinToString("\n", postfix = "\n") + } + + private fun copyWithout(from: File, to: File, startup: String?) { ZipFile(from).use { zip -> ZipOutputStream(to.outputStream().buffered()).use { out -> - for (entry in zip.entries().asSequence().sortedBy { it.name }) { - if (entry.name.startsWith("META-INF/maven/") || entry.name.endsWith(".kotlin_builtins")) continue + val entries = zip.entries().asSequence().map { it.name }.filter { it != STARTUP_CLASSES }.toMutableList() + if (startup != null) entries += STARTUP_CLASSES + for (name in entries.sorted()) { + if (name.startsWith("META-INF/maven/") || name.endsWith(".kotlin_builtins")) continue // Fixed times, so the same input gives the same jar. - out.putNextEntry(ZipEntry(entry.name).apply { time = FIXED_TIME }) - zip.getInputStream(entry).use { it.copyTo(out) } + out.putNextEntry(ZipEntry(name).apply { time = FIXED_TIME }) + if (name == STARTUP_CLASSES && startup != null) { + out.write(startup.toByteArray()) + } else { + zip.getInputStream(zip.getEntry(name)).use { it.copyTo(out) } + } out.closeEntry() } } } } - private companion object { + companion object { + /** Where the startup list goes in the jar, which the shim reads (core-loader's BukkitBootstrap). */ + const val STARTUP_CLASSES = "META-INF/xena/startup-classes.txt" + // 1980-02-01, as Gradle's reproducible archives use. const val FIXED_TIME = 318_211_200_000L } diff --git a/build-logic/src/main/kotlin/xena.r8.gradle.kts b/build-logic/src/main/kotlin/xena.r8.gradle.kts index 1c662fc9..587ffb92 100644 --- a/build-logic/src/main/kotlin/xena.r8.gradle.kts +++ b/build-logic/src/main/kotlin/xena.r8.gradle.kts @@ -32,6 +32,7 @@ val xenaR8 = extensions.create("xenaR8").apply { "co.xenastudios." + path.split(':').filter { it.isNotEmpty() }.joinToString(".") { it.replace("-", "").lowercase() } + ".r8", ) rules.convention(fileTree("r8") { include("*.pro") }) + startupClasses.convention(files("startup-classes.txt")) } plugins.withId("com.gradleup.shadow") { @@ -48,6 +49,7 @@ val shrinkJar = tasks.register("shrinkJar") { libraries.from(xenaR8.libraries) rules.from(xenaR8.rules) packageName.set(xenaR8.packageName) + startupClasses.from(xenaR8.startupClasses) // R8 runs on, and reads java.* from, the JDK running the build. launcher.set(javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(JavaVersion.current().majorVersion)) diff --git a/core/core-loader/build.gradle.kts b/core/core-loader/build.gradle.kts index 35406c90..22070cdc 100644 --- a/core/core-loader/build.gradle.kts +++ b/core/core-loader/build.gradle.kts @@ -9,3 +9,28 @@ dependencies { // The oldest Bukkit API the family runs on, so the shim uses nothing newer. compileOnly(libs.spigot.api.floor) { isTransitive = false } } + +// Paper's plugin loader (paper-plugin.yml's `loader`), which hands Paper the plugin's libraries +// from the family's cache instead of plugin.yml's `libraries:` (PaperLibraryLoader). Compiled +// against Paper's API, never shipped with it, to Java 17 class files: Paper plugins exist from +// 1.19.3, which ran on Java 17. Main's classes don't see it, so a server without Paper's API +// never loads it. +val paper = sourceSets.create("paper") { + compileClasspath += sourceSets.main.get().output +} +configurations.named(paper.compileClasspathConfigurationName) { + attributes { attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21) } +} +dependencies { + "paperCompileOnly"(libs.paper.api) +} +tasks.named("compilePaperJava") { + // Paper's API is Java 21 class files, which --release 17 can't read, so -source/-target. + options.release.unset() + sourceCompatibility = "17" + targetCompatibility = "17" + options.compilerArgs.remove("-Werror") +} +tasks.jar { + from(paper.output) +} diff --git a/core/core-loader/src/main/java/co/xenastudios/core/loader/bukkit/BukkitBootstrap.java b/core/core-loader/src/main/java/co/xenastudios/core/loader/bukkit/BukkitBootstrap.java index bc94367a..fc11d472 100644 --- a/core/core-loader/src/main/java/co/xenastudios/core/loader/bukkit/BukkitBootstrap.java +++ b/core/core-loader/src/main/java/co/xenastudios/core/loader/bukkit/BukkitBootstrap.java @@ -3,17 +3,19 @@ import co.xenastudios.core.loader.JavaVersion; import co.xenastudios.core.loader.Libraries; import co.xenastudios.core.loader.Library; -import co.xenastudios.core.loader.LibraryCache; import co.xenastudios.core.loader.LibraryException; import co.xenastudios.core.loader.Manifest; import co.xenastudios.core.loader.OnDemandLibraries; import co.xenastudios.core.loader.PluginEntry; import co.xenastudios.core.loader.Strategy; +import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import java.nio.charset.StandardCharsets; import java.security.CodeSource; import java.util.ArrayList; import java.util.Collections; @@ -53,10 +55,6 @@ */ public abstract class BukkitBootstrap extends JavaPlugin { - /** The family's shared folder, beside each plugin's own. */ - private static final String SHARED = "Xena"; - private static final String SETTINGS = "libraries.yml"; - /** * {@code -Dxena.startupTimes=true}: each plugin logs how long its onLoad and onEnable took, * for the budget check (scripts/budgets/check.sh), which can't tell from the log where the @@ -79,6 +77,9 @@ public abstract class BukkitBootstrap extends JavaPlugin { "kotlin.collections.builders.MapBuilder", }; + /** The classes a plugin loads as it starts, in the jar, written by build-logic's R8Shrink. */ + private static final String STARTUP_CLASSES = "META-INF/xena/startup-classes.txt"; + private PluginEntry entry; /** The entry point's class, made at onEnable when it has nothing to do at onLoad. */ private Class entryType; @@ -126,8 +127,13 @@ public final void onEnable() { } entry.enable(); if (STARTUP_TIMES) { - getLogger().info(String.format(Locale.ROOT, "Startup times: onLoad %.1f ms, onEnable %.1f ms", - loadNanos / 1e6, (System.nanoTime() - started) / 1e6)); + // On Paper with paper-plugin.yml, the plugin's loader too (its libraries handed + // to Paper), which no line of the server's shows. + String loader = System.getProperty("xena.startupTimes.loader." + getName()); + String provider = loader == null ? "" + : String.format(Locale.ROOT, "loader %.1f ms, ", Long.parseLong(loader) / 1e6); + getLogger().info(String.format(Locale.ROOT, "Startup times: %sonLoad %.1f ms, onEnable %.1f ms", + provider, loadNanos / 1e6, (System.nanoTime() - started) / 1e6)); } return; } catch (Throwable e) { @@ -165,8 +171,9 @@ private Class start() throws Exception { List libraries = Manifest.read(own); ClassLoader loader = own; if (!libraries.isEmpty()) { - YamlConfiguration settings = settings(new File(shared(), SETTINGS)); - loader = Libraries.load(libraries, own, getFile().toURI().toURL(), cache(settings), running, strategy(settings), + File plugins = getDataFolder().getParentFile(); + YamlConfiguration settings = LoaderSettings.read(plugins); + loader = Libraries.load(libraries, own, getFile().toURI().toURL(), LoaderSettings.cache(plugins, settings), running, strategy(settings), getLogger()).loader(); checkKotlin(libraries, loader); preload(libraries, loader); @@ -184,27 +191,35 @@ private static boolean overridesLoad(Class type) { } /** - * Loads {@link #PRELOAD} on a daemon thread, without running anything in them, when the - * plugin uses the stdlib. Class loading is safe from any thread: if the server's thread - * wants a class this one is loading, it waits for that class alone, as it would have - * loaded it itself. + * Loads, without initializing, the classes the plugin needs as it starts, on a daemon thread + * of its own while the server prepares its worlds between onLoad and onEnable: the jar's + * {@value #STARTUP_CLASSES} (written at build time from a list recorded on a real server, + * DECISIONS.md), or {@link #PRELOAD} when the jar has none and uses the stdlib. Class + * loading is safe from any thread: if the server's thread wants a class this one is loading, + * it waits for that class alone, as it would have loaded it itself. Nothing in them runs, so + * no listener, task or static state of a module starts here. */ private void preload(List libraries, final ClassLoader loader) { - boolean kotlin = false; - for (Library library : libraries) { - kotlin |= library.coordinates().startsWith("org.jetbrains.kotlin:kotlin-stdlib:"); - } - if (!kotlin) { - return; + final List names = startupClasses(); + if (names.isEmpty()) { + boolean kotlin = false; + for (Library library : libraries) { + kotlin |= library.coordinates().startsWith("org.jetbrains.kotlin:kotlin-stdlib:"); + } + if (!kotlin) { + return; + } + Collections.addAll(names, PRELOAD); } Thread thread = new Thread(new Runnable() { @Override public void run() { - for (String name : PRELOAD) { + for (String name : names) { try { Class.forName(name, false, loader); } catch (Throwable ignored) { - // A class another Kotlin release doesn't have: the plugin loads what it uses itself. + // A class this server doesn't have (another Kotlin release, a platform path + // that isn't this one's): the plugin loads what it uses itself. } } } @@ -214,6 +229,25 @@ public void run() { thread.start(); } + /** The jar's {@value #STARTUP_CLASSES}, one class a line; empty when it has none. */ + private List startupClasses() { + List names = new ArrayList<>(); + InputStream in = getClass().getClassLoader().getResourceAsStream(STARTUP_CLASSES); + if (in == null) { + return names; + } + try (BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))) { + for (String line = reader.readLine(); line != null; line = reader.readLine()) { + if (!line.trim().isEmpty()) { + names.add(line.trim()); + } + } + } catch (IOException e) { + names.clear(); + } + return names; + } + /** * The libraries the plugin fetches only when a feature needs one (its JDBC drivers), from its * jar's {@value OnDemandLibraries#RESOURCE}, in the family's shared cache with the owner's @@ -221,18 +255,7 @@ public void run() { * settings file, so call it off the server's threads, or once at startup. */ public final OnDemandLibraries onDemandLibraries() throws IOException { - return OnDemandLibraries.read(getClass().getClassLoader(), cache(settings(new File(shared(), SETTINGS)))); - } - - /** {@code plugins/Xena/}, the family's folder, beside the plugin's own. */ - private File shared() { - return new File(getDataFolder().getParentFile(), SHARED); - } - - private LibraryCache cache(YamlConfiguration settings) { - String help = "If this server can't reach Maven Central, set mirror: in " + new File(shared(), SETTINGS) - + " to a Maven repository it can reach."; - return new LibraryCache(new File(shared(), "libraries").toPath(), mirrors(settings), help); + return OnDemandLibraries.read(getClass().getClassLoader(), LoaderSettings.cache(getDataFolder().getParentFile())); } /** The Java the plugin's Kotlin classes were compiled for, from the entry point's class file. */ @@ -246,24 +269,6 @@ private int neededJava() throws IOException { } } - private static YamlConfiguration settings(File file) { - return file.isFile() ? YamlConfiguration.loadConfiguration(file) : new YamlConfiguration(); - } - - private static List mirrors(YamlConfiguration settings) { - String flag = System.getProperty("xena.libraries.mirror"); - if (flag != null && !flag.trim().isEmpty()) { - List mirrors = new ArrayList<>(); - Collections.addAll(mirrors, flag.split(",")); - return mirrors; - } - if (settings.isList("mirror")) { - return settings.getStringList("mirror"); - } - String mirror = settings.getString("mirror"); - return mirror == null || mirror.trim().isEmpty() ? LibraryCache.DEFAULT_MIRRORS : Collections.singletonList(mirror); - } - private Strategy strategy(YamlConfiguration settings) { String name = System.getProperty("xena.libraries.loader", settings.getString("loader")); try { diff --git a/core/core-loader/src/main/java/co/xenastudios/core/loader/bukkit/LoaderSettings.java b/core/core-loader/src/main/java/co/xenastudios/core/loader/bukkit/LoaderSettings.java new file mode 100644 index 00000000..b1162c23 --- /dev/null +++ b/core/core-loader/src/main/java/co/xenastudios/core/loader/bukkit/LoaderSettings.java @@ -0,0 +1,54 @@ +package co.xenastudios.core.loader.bukkit; + +import co.xenastudios.core.loader.LibraryCache; +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.bukkit.configuration.file.YamlConfiguration; + +/** + * The family's library settings on Bukkit-family servers, {@code plugins/Xena/libraries.yml} or + * {@code -D} flags, and the cache they describe: for the shim ({@link BukkitBootstrap}) and + * Paper's plugin loader alike. + */ +public final class LoaderSettings { + + /** The family's shared folder, beside each plugin's own. */ + static final String SHARED = "Xena"; + static final String FILE = "libraries.yml"; + + private LoaderSettings() {} + + /** {@code plugins/Xena/libraries.yml}, read; empty when there's none. */ + static YamlConfiguration read(File plugins) { + File file = new File(new File(plugins, SHARED), FILE); + return file.isFile() ? YamlConfiguration.loadConfiguration(file) : new YamlConfiguration(); + } + + /** The family's cache in {@code plugins/Xena/libraries/}, with the owner's mirrors. */ + public static LibraryCache cache(File plugins) { + return cache(plugins, read(plugins)); + } + + static LibraryCache cache(File plugins, YamlConfiguration settings) { + File shared = new File(plugins, SHARED); + String help = "If this server can't reach Maven Central, set mirror: in " + new File(shared, FILE) + + " to a Maven repository it can reach."; + return new LibraryCache(new File(shared, "libraries").toPath(), mirrors(settings), help); + } + + private static List mirrors(YamlConfiguration settings) { + String flag = System.getProperty("xena.libraries.mirror"); + if (flag != null && !flag.trim().isEmpty()) { + List mirrors = new ArrayList<>(); + Collections.addAll(mirrors, flag.split(",")); + return mirrors; + } + if (settings.isList("mirror")) { + return settings.getStringList("mirror"); + } + String mirror = settings.getString("mirror"); + return mirror == null || mirror.trim().isEmpty() ? LibraryCache.DEFAULT_MIRRORS : Collections.singletonList(mirror); + } +} diff --git a/core/core-loader/src/paper/java/co/xenastudios/core/loader/paper/PaperLibraryLoader.java b/core/core-loader/src/paper/java/co/xenastudios/core/loader/paper/PaperLibraryLoader.java new file mode 100644 index 00000000..fb8082a0 --- /dev/null +++ b/core/core-loader/src/paper/java/co/xenastudios/core/loader/paper/PaperLibraryLoader.java @@ -0,0 +1,69 @@ +package co.xenastudios.core.loader.paper; + +import co.xenastudios.core.loader.Library; +import co.xenastudios.core.loader.LibraryCache; +import co.xenastudios.core.loader.LibraryException; +import co.xenastudios.core.loader.Manifest; +import co.xenastudios.core.loader.bukkit.LoaderSettings; +import io.papermc.paper.plugin.loader.PluginClasspathBuilder; +import io.papermc.paper.plugin.loader.PluginLoader; +import io.papermc.paper.plugin.loader.library.impl.JarLibrary; +import java.io.File; +import java.io.IOException; +import java.util.List; + +/** + * The libraries of a plugin on Paper and Folia (1.19.3 on), where its jar's + * {@code paper-plugin.yml} names this class as its {@code loader}: each library in the jar's + * {@value Manifest#RESOURCE} from the family's cache in {@code plugins/Xena/libraries/} + * (downloaded and checked against its pinned SHA-256 there, as the Bukkit shim does below + * 1.16.5), handed to Paper as a {@link JarLibrary}. + * + *

In place of {@code plugin.yml}'s {@code libraries:}, which Paper resolves with Maven's + * resolver at every boot (about 50 ms of the server thread on Paper 1.21.11, the same for one + * library or five, DECISIONS.md), and whose class loader rewrites every class it loads. Spigot + * and Paper before 1.19.3 ignore {@code paper-plugin.yml} and keep reading {@code plugin.yml}. + * + *

Java 17 class files, as Paper 1.19.3 to 1.20.4 run on 17; Paper's API is compiled + * against, never shipped. + */ +public final class PaperLibraryLoader implements PluginLoader { + + @Override + public void classloader(PluginClasspathBuilder classpathBuilder) { + long started = System.nanoTime(); + try { + handOver(classpathBuilder); + } finally { + // For the budget check, which the shim tells: this is the server thread's time for the + // plugin's libraries, as plugin.yml's libraries: lines show it on Spigot. + if (Boolean.getBoolean("xena.startupTimes")) { + System.setProperty("xena.startupTimes.loader." + classpathBuilder.getContext().getConfiguration().getName(), + Long.toString(System.nanoTime() - started)); + } + } + } + + private static void handOver(PluginClasspathBuilder classpathBuilder) { + ClassLoader own = PaperLibraryLoader.class.getClassLoader(); + File plugins = classpathBuilder.getContext().getDataDirectory().toFile().getParentFile(); + try { + List libraries = Manifest.read(own); + if (libraries.isEmpty()) { + return; + } + LibraryCache cache = LoaderSettings.cache(plugins); + for (Library library : libraries) { + LibraryCache.Fetched jar = cache.fetch(library); + if (jar.downloadedFrom() != null) { + classpathBuilder.getContext().getLogger().info("Downloaded " + library + " from " + jar.downloadedFrom() + + " into " + cache.folder()); + } + classpathBuilder.addLibrary(new JarLibrary(jar.jar())); + } + } catch (IOException | LibraryException e) { + // The shim, seeing no stdlib, tries again at onLoad and says why if it can't. + classpathBuilder.getContext().getLogger().error("Couldn't load the plugin's libraries: " + e.getMessage()); + } + } +} diff --git a/core/core-testing/sample/bukkit/build.gradle.kts b/core/core-testing/sample/bukkit/build.gradle.kts index caccc8c3..dc36e98d 100644 --- a/core/core-testing/sample/bukkit/build.gradle.kts +++ b/core/core-testing/sample/bukkit/build.gradle.kts @@ -50,7 +50,7 @@ tasks.processResources { "libraries" to fetchedCoordinates.get().joinToString("") { "\n - $it" }, ) inputs.properties(props) - filesMatching("plugin.yml") { expand(props) } + filesMatching(listOf("plugin.yml", "paper-plugin.yml")) { expand(props) } } tasks.shadowJar { diff --git a/core/core-testing/sample/bukkit/src/main/resources/paper-plugin.yml b/core/core-testing/sample/bukkit/src/main/resources/paper-plugin.yml new file mode 100644 index 00000000..774951d3 --- /dev/null +++ b/core/core-testing/sample/bukkit/src/main/resources/paper-plugin.yml @@ -0,0 +1,11 @@ +# Paper and Folia from 1.19.3 read this instead of plugin.yml; Spigot and older Paper ignore it. +# The same plugin, with its libraries handed to Paper by the core's loader from the family's +# cache rather than resolved by Paper from plugin.yml's libraries: at every boot (DECISIONS.md). +name: xSample +version: '${version}' +main: co.xenastudios.xsample.bukkit.XSampleBootstrap +# The core's, relocated into the plugin's package with the rest of it. +loader: co.xenastudios.xsample.core.loader.paper.PaperLibraryLoader +api-version: '1.19' +folia-supported: true +description: The core's sample plugin on Bukkit, for boot tests. Never released. diff --git a/core/core-testing/sample/bukkit/startup-classes.txt b/core/core-testing/sample/bukkit/startup-classes.txt new file mode 100644 index 00000000..2e12d05b --- /dev/null +++ b/core/core-testing/sample/bukkit/startup-classes.txt @@ -0,0 +1,598 @@ +# The classes this plugin loads as it starts, recorded on Paper by scripts/budgets/check.sh +# --record-startup: the shim loads them on a thread of its own before onEnable (DECISIONS.md). +# In their names before R8; R8Shrink maps them. Record again after big changes. +co.xenastudios.xsample.core.loader.paper.PaperLibraryLoader +co.xenastudios.xsample.core.loader.LibraryException +co.xenastudios.xsample.core.loader.Manifest +co.xenastudios.xsample.core.loader.Library +co.xenastudios.xsample.core.loader.bukkit.LoaderSettings +co.xenastudios.xsample.core.loader.LibraryCache +co.xenastudios.xsample.core.common.admin.Debug$0 +co.xenastudios.xsample.core.loader.Sha256 +co.xenastudios.xsample.core.loader.LibraryCache$Fetched +co.xenastudios.xsample.core.loader.bukkit.BukkitBootstrap +co.xenastudios.xsample.bukkit.XSampleBootstrap +co.xenastudios.xsample.core.loader.Strategy +co.xenastudios.xsample.core.loader.Libraries +co.xenastudios.xsample.core.loader.Libraries$ChildFirst +okio.Okio +it.krzeminski.snakeyaml.engine.kmp.api.Dump +net.thauvin.erik.urlencoder.Character +kotlin.Lazy +co.xenastudios.xsample.core.loader.Libraries$Loaded +kotlin.KotlinVersion +kotlin.KotlinVersion$Companion +kotlin.KotlinVersionCurrentValue +co.xenastudios.xsample.core.loader.bukkit.BukkitBootstrap$1 +co.xenastudios.xsample.core.loader.PluginEntry +co.xenastudios.xsample.bukkit.XSampleBukkit +co.xenastudios.xsample.core.common.permission.PermissionSet +co.xenastudios.xsample.core.sample.SamplePermissions +co.xenastudios.xsample.core.common.command.AdminCommands$declared$1 +co.xenastudios.xsample.core.common.scheduler.Where +co.xenastudios.xsample.core.common.scheduler.Where$Async +kotlin.collections.ArraysKt__ArraysJVMKt +kotlin.collections.ArraysKt__ArraysKt +kotlin.collections.ArraysKt___ArraysJvmKt +kotlin.collections.ArraysKt___ArraysKt +kotlin.collections.ArraysKt +kotlin.collections.CollectionsKt__CollectionsJVMKt +kotlin.collections.CollectionsKt__CollectionsKt +kotlin.collections.CollectionsKt__IterablesKt +kotlin.collections.CollectionsKt__IteratorsJVMKt +kotlin.collections.CollectionsKt__IteratorsKt +kotlin.collections.CollectionsKt__MutableCollectionsJVMKt +kotlin.collections.CollectionsKt__MutableCollectionsKt +kotlin.collections.CollectionsKt__ReversedViewsKt +kotlin.collections.CollectionsKt___CollectionsJvmKt +kotlin.collections.CollectionsKt___CollectionsKt +kotlin.collections.CollectionsKt +kotlin.collections.MapsKt__MapWithDefaultKt +kotlin.collections.MapsKt__MapsJVMKt +kotlin.collections.MapsKt__MapsKt +kotlin.collections.MapsKt___MapsJvmKt +kotlin.collections.MapsKt___MapsKt +kotlin.collections.MapsKt +kotlin.collections.SetsKt__SetsJVMKt +kotlin.collections.SetsKt__SetsKt +kotlin.collections.SetsKt___SetsKt +kotlin.collections.SetsKt +kotlin.text.StringsKt__AppendableKt +kotlin.text.StringsKt__IndentKt +kotlin.text.StringsKt__RegexExtensionsJVMKt +kotlin.text.StringsKt__RegexExtensionsKt +kotlin.text.StringsKt__StringBuilderJVMKt +kotlin.text.StringsKt__StringBuilderKt +kotlin.text.StringsKt__StringNumberConversionsJVMKt +kotlin.text.StringsKt__StringNumberConversionsKt +kotlin.text.StringsKt__StringsJVMKt +kotlin.text.StringsKt__StringsKt +kotlin.text.StringsKt___StringsJvmKt +kotlin.text.StringsKt___StringsKt +kotlin.text.StringsKt +kotlin.sequences.SequencesKt__SequenceBuilderKt +kotlin.sequences.SequencesKt__SequencesJVMKt +kotlin.sequences.SequencesKt__SequencesKt +kotlin.sequences.SequencesKt___SequencesJvmKt +kotlin.sequences.SequencesKt___SequencesKt +kotlin.sequences.SequencesKt +kotlin.ranges.RangesKt__RangesKt +kotlin.ranges.RangesKt___RangesKt +kotlin.ranges.RangesKt +kotlin.text.CharsKt__CharJVMKt +kotlin.text.CharsKt__CharKt +kotlin.text.CharsKt +kotlin.text.Regex +kotlin.text.HexExtensionsKt +kotlin.time.Duration +kotlin.time.DurationKt +kotlin.uuid.Uuid +kotlin.uuid.UuidKt__UuidJVMKt +kotlin.uuid.UuidKt__UuidKt +kotlin.uuid.UuidKt +kotlin.jvm.internal.markers.KMappedMarker +kotlin.jvm.internal.markers.KMutableIterable +kotlin.jvm.internal.markers.KMutableCollection +kotlin.jvm.internal.markers.KMutableList +kotlin.collections.AbstractMutableList +kotlin.collections.ArrayDeque +kotlin.jvm.internal.markers.KMutableMap +kotlin.collections.builders.MapBuilder +co.xenastudios.xsample.core.common.admin.AdminText +co.xenastudios.xsample.core.common.admin.AdminText$Companion +co.xenastudios.xsample.core.common.text.Placeholder +kotlin.Function +kotlin.jvm.functions.Function1 +co.xenastudios.xsample.core.common.command.CommandSource +co.xenastudios.xsample.core.common.i18n.MessageKey +co.xenastudios.xsample.core.common.text.Component +kotlin.jvm.functions.Function0 +co.xenastudios.xsample.core.common.i18n.Formats +kotlin.LazyKt__LazyJVMKt +kotlin.LazyKt__LazyKt +kotlin.LazyKt +kotlin.NoWhenBranchMatchedException +kotlin.jvm.internal.Intrinsics +kotlin.KotlinNullPointerException +kotlin.UninitializedPropertyAccessException +kotlin.SynchronizedLazyImpl +kotlin.UNINITIALIZED_VALUE +co.xenastudios.xsample.core.bukkit.BukkitPlatform$Companion +co.xenastudios.xsample.core.common.platform.Platform +co.xenastudios.xsample.core.bukkit.BukkitPlatform +co.xenastudios.xsample.core.common.scheduler.Scheduler +co.xenastudios.xsample.core.common.text.TextRenderer +co.xenastudios.xsample.core.bukkit.ClientLocales +co.xenastudios.xsample.core.bukkit.ClientLocales$Companion$modern$1 +co.xenastudios.xsample.core.bukkit.ClientLocales$Spigot +co.xenastudios.xsample.core.bukkit.ClientLocales$None +co.xenastudios.xsample.core.bukkit.BukkitServer +kotlin.collections.ArraysUtilJVM +co.xenastudios.xsample.core.bukkit.BukkitServer$Companion +co.xenastudios.xsample.core.bukkit.BukkitServer$Flavor +kotlin.enums.EnumEntriesKt +kotlin.NotImplementedError +kotlin.enums.EnumEntries +kotlin.collections.AbstractCollection +kotlin.collections.AbstractList +kotlin.enums.EnumEntriesList +kotlin.collections.AbstractList$Companion +co.xenastudios.xsample.core.bukkit.GameVersion +kotlin.text.Regex$Companion +co.xenastudios.xsample.core.bukkit.GameVersion$Companion +kotlin.text.RegexKt +kotlin.text.MatchResult +kotlin.text.MatcherMatchResult +kotlin.text.MatchGroupCollection +kotlin.text.MatchNamedGroupCollection +kotlin.text.MatcherMatchResult$groups$1 +kotlin.text.MatchResult$DefaultImpls +kotlin.text.MatchResult$Destructured +kotlin.text.MatcherMatchResult$groupValues$1 +co.xenastudios.xsample.core.common.platform.Threading +co.xenastudios.xsample.core.common.platform.Capability +co.xenastudios.xsample.core.bukkit.JulLog +co.xenastudios.xsample.core.common.platform.SystemClock +kotlin.time.TimeSource +kotlin.time.TimeSource$WithComparableMarks +kotlin.time.TimeSource$Monotonic +kotlin.time.TimeMark +kotlin.time.ComparableTimeMark +kotlin.time.MonotonicTimeSource +kotlin.time.TimeSource$Monotonic$ValueTimeMark +co.xenastudios.xsample.core.jvm.platform.FolderStorage +co.xenastudios.xsample.core.common.Outcome +co.xenastudios.xsample.core.common.Outcome$Ok +co.xenastudios.xsample.core.common.Outcome$Err +co.xenastudios.xsample.core.bukkit.MainThreadScheduler +co.xenastudios.xsample.core.common.scheduler.Task +co.xenastudios.xsample.core.bukkit.BukkitPlayers$Companion +co.xenastudios.xsample.core.bukkit.Entities +co.xenastudios.xsample.core.bukkit.AsyncExecutor +co.xenastudios.xsample.core.bukkit.BukkitText +co.xenastudios.xsample.core.bukkit.modern.AdventureText +co.xenastudios.xsample.core.jvm.text.AdventureRenderer +co.xenastudios.xsample.core.common.text.ClickEvent$Action +co.xenastudios.xsample.core.common.i18n.Delivery +co.xenastudios.xsample.core.api.PlayerRef +co.xenastudios.xsample.core.bukkit.modern.ModernLocales +co.xenastudios.xsample.core.common.scheduler.Where$On +co.xenastudios.xsample.core.bukkit.modern.ModernLocales$handler$1 +co.xenastudios.xsample.core.bukkit.BukkitPlayers +co.xenastudios.xsample.core.bukkit.BukkitCommands$Companion +co.xenastudios.xsample.core.bukkit.BukkitCommands +co.xenastudios.xsample.core.bukkit.BukkitCommands$Root +kotlin.jvm.internal.TypeIntrinsics +kotlin.Unit +co.xenastudios.xsample.core.common.command.CommandFeedback +co.xenastudios.xsample.core.common.command.CommandFeedback$Companion +co.xenastudios.xsample.core.common.command.CommandResult +co.xenastudios.xsample.core.bukkit.BukkitPermissions +co.xenastudios.xsample.core.common.permission.PermissionDefault +co.xenastudios.xsample.core.bukkit.BukkitEvents +co.xenastudios.xsample.core.bukkit.XenaEvent +co.xenastudios.xsample.core.bukkit.XenaCancellableEvent +co.xenastudios.xsample.core.common.family.Family +co.xenastudios.xsample.core.common.config.ConfigGroup +co.xenastudios.xsample.core.common.config.ConfigSchema +co.xenastudios.xsample.core.common.family.FamilyConfig +co.xenastudios.xsample.core.common.platform.StoragePath +kotlin.collections.EmptyList +co.xenastudios.xsample.core.common.platform.StoragePath$Companion +co.xenastudios.xsample.core.bukkit.BukkitFamily +kotlin.time.Duration$Companion +kotlin.time.DurationJvmKt +kotlin.time.DurationUnit +kotlin.time.DurationUnitKt__DurationUnitJvmKt +kotlin.time.DurationUnitKt__DurationUnitKt +kotlin.time.DurationUnitKt +co.xenastudios.xsample.core.jvm.family.JvmFamilyBoard +co.xenastudios.xsample.core.common.config.YamlReader +co.xenastudios.xsample.core.jvm.config.JvmYaml +it.krzeminski.snakeyaml.engine.kmp.exceptions.YamlEngineException +it.krzeminski.snakeyaml.engine.kmp.exceptions.MarkedYamlEngineException +co.xenastudios.xsample.core.jvm.config.JvmYaml$Failure +co.xenastudios.xsample.core.common.config.YamlNode +co.xenastudios.xsample.core.common.config.YamlNode$Null +co.xenastudios.xsample.core.common.config.YamlNode$Scalar +co.xenastudios.xsample.core.common.config.YamlNode$Sequence +it.krzeminski.snakeyaml.engine.kmp.nodes.Node +it.krzeminski.snakeyaml.engine.kmp.nodes.ScalarNode +co.xenastudios.xsample.core.common.config.YamlNode$Mapping +it.krzeminski.snakeyaml.engine.kmp.api.LoadSettings +co.xenastudios.xsample.core.common.config.ConfigType +co.xenastudios.xsample.core.common.config.ConfigType$Companion$text$2 +co.xenastudios.xsample.core.common.config.ConfigNode +co.xenastudios.xsample.core.common.config.ConfigSection +co.xenastudios.xsample.core.common.family.MySqlSection +co.xenastudios.xsample.core.common.config.ConfigGroup$Companion +co.xenastudios.xsample.core.common.config.Config +co.xenastudios.xsample.core.common.family.MessagesSection +co.xenastudios.xsample.core.common.family.Shareable +co.xenastudios.xsample.core.common.family.Shareable$Own +co.xenastudios.xsample.core.common.family.Shareable$Shared +co.xenastudios.xsample.core.common.family.Shareable$ShareableType +co.xenastudios.xsample.core.common.i18n.LanguageChoice +co.xenastudios.xsample.core.common.time.DurationError$Kind +co.xenastudios.xsample.core.common.config.ConfigType$Companion +kotlin.jvm.internal.FunctionBase +kotlin.reflect.KAnnotatedElement +kotlin.reflect.KCallable +kotlin.reflect.KFunction +kotlin.jvm.internal.KotlinGenericDeclaration +kotlin.jvm.internal.CallableReference +kotlin.jvm.internal.FunctionReference +kotlin.jvm.internal.FunctionReferenceImpl +co.xenastudios.xsample.core.common.config.ConfigType$Companion$DOUBLE$1 +kotlin.jvm.KotlinReflectionNotSupportedError +kotlin.reflect.KDeclarationContainer +kotlin.jvm.internal.CallableReference$NoReceiver +co.xenastudios.xsample.core.common.config.ConfigType$Companion$DURATION$1 +co.xenastudios.xsample.core.common.time.Durations +kotlin.Pair +kotlin.TuplesKt +co.xenastudios.xsample.core.common.i18n.LanguageChoice$Auto +co.xenastudios.xsample.core.common.i18n.LanguageSettings +co.xenastudios.xsample.core.common.i18n.LanguageTag +co.xenastudios.xsample.core.common.family.Shareable$Companion +co.xenastudios.xsample.core.common.config.ConfigKey +co.xenastudios.xsample.core.common.family.ThemeSection +co.xenastudios.xsample.core.common.family.ThemeSection$Companion +co.xenastudios.xsample.core.common.family.ThemeSection$Companion$STYLE$1 +co.xenastudios.xsample.core.common.text.Theme +co.xenastudios.xsample.core.common.text.Style +co.xenastudios.xsample.core.common.text.TextColor +kotlin.collections.MapWithDefault +co.xenastudios.xsample.core.common.text.MarkupTag +co.xenastudios.xsample.core.common.text.MarkupTag$Styling +co.xenastudios.xsample.core.common.text.Markup +co.xenastudios.xsample.core.common.text.Markup$Companion +co.xenastudios.xsample.core.common.text.Markup$Parser +co.xenastudios.xsample.core.common.text.Markup$Parser$Kind +co.xenastudios.xsample.core.common.text.Node +kotlin.collections.ArrayDeque$Companion +co.xenastudios.xsample.core.common.text.Markup$Parser$Frame +co.xenastudios.xsample.core.common.text.TextColor$Companion +co.xenastudios.xsample.core.common.text.Markup$Parser$Opened$Push +co.xenastudios.xsample.core.common.text.Node$Text +co.xenastudios.xsample.core.common.text.Node$Styled +kotlin.collections.EmptyMap +co.xenastudios.xsample.core.common.text.Node$Insert +co.xenastudios.xsample.core.common.text.MarkupTag$Inserting +co.xenastudios.xsample.core.common.family.DatabaseSection +co.xenastudios.xsample.core.common.config.ConfigType$EnumType +co.xenastudios.xsample.core.common.family.StorageType +co.xenastudios.xsample.core.common.family.PoolSection +co.xenastudios.xsample.core.common.family.FamilyConfig$Players +co.xenastudios.xsample.core.common.family.PlayerCache +co.xenastudios.xsample.core.common.db.Table +co.xenastudios.xsample.core.common.family.PlayerCache$Players +co.xenastudios.xsample.core.common.db.CorruptValueException +co.xenastudios.xsample.core.common.db.ColumnType +co.xenastudios.xsample.core.common.db.SqlValue +co.xenastudios.xsample.core.common.db.SqlValue$Integer +co.xenastudios.xsample.core.common.db.SqlValue$Bytes +co.xenastudios.xsample.core.common.db.SqlValue$Null +co.xenastudios.xsample.core.common.db.SqlValue$Real +kotlin.time.Instant +co.xenastudios.xsample.core.common.db.Column +co.xenastudios.xsample.core.common.db.ColumnType$Companion +co.xenastudios.xsample.core.common.db.SqlValue$Text +co.xenastudios.xsample.core.bukkit.BukkitServer$0 +co.xenastudios.xsample.core.common.db.Index +co.xenastudios.xsample.core.common.db.Migration +co.xenastudios.xsample.core.common.db.Sql +co.xenastudios.xsample.core.common.family.PlayerStore +co.xenastudios.xsample.core.common.family.PlayerStore$InFile +co.xenastudios.xsample.core.jvm.family.JvmFamilyBoard$JdkMap +co.xenastudios.xsample.core.common.family.PlayerCache$Companion +co.xenastudios.xsample.core.common.Concurrency_jvmKt +co.xenastudios.xsample.core.bukkit.BukkitFamily$record$handler$1 +co.xenastudios.xsample.core.sample.XSample +co.xenastudios.xsample.core.common.command.ArgumentType +co.xenastudios.xsample.core.api.event.Event +co.xenastudios.xsample.core.api.event.Cancellable +co.xenastudios.xsample.core.api.event.CancellableEvent +co.xenastudios.xsample.core.sample.CoinsPaidEvent +co.xenastudios.xsample.core.sample.SampleConfig +co.xenastudios.xsample.core.common.admin.PlayerLookup +co.xenastudios.xsample.bukkit.XSampleBukkit$enable$sample$1 +co.xenastudios.xsample.core.sample.SampleConfig$Interest +co.xenastudios.xsample.core.api.event.EventBus +co.xenastudios.xsample.core.common.event.SimpleEventBus +co.xenastudios.xsample.core.api.event.EventPriority +co.xenastudios.xsample.core.common.module.ModuleSet +co.xenastudios.xsample.core.common.scheduler.Where$Global +co.xenastudios.xsample.core.common.scheduler.WrongThreadException +co.xenastudios.xsample.core.common.admin.PlayerDataRegistry +co.xenastudios.xsample.core.common.admin.PlayerData +co.xenastudios.xsample.core.common.command.ModuleReloader +co.xenastudios.xsample.core.sample.XSample$admin$1 +co.xenastudios.xsample.core.sample.XSample$admin$2 +co.xenastudios.xsample.core.common.admin.HealthChecks +co.xenastudios.xsample.core.common.admin.HealthCheck +co.xenastudios.xsample.core.common.admin.Debug +co.xenastudios.xsample.core.common.admin.Health$Status +co.xenastudios.xsample.core.common.admin.DebugResult +co.xenastudios.xsample.core.common.admin.DebugResult$Saved +co.xenastudios.xsample.core.common.admin.DebugResult$Failed +co.xenastudios.xsample.core.common.command.AdminCommands +co.xenastudios.xsample.core.common.command.AdminSubcommand +kotlin.collections.AbstractList$IteratorImpl +co.xenastudios.xsample.core.common.permission.Permission +kotlin.collections.EmptySet +kotlin.collections.EmptyIterator +co.xenastudios.xsample.core.common.command.CommandDispatcher +co.xenastudios.xsample.core.common.command.CommandFailure +co.xenastudios.xsample.core.common.command.CommandResult$Unknown +co.xenastudios.xsample.core.common.command.CommandResult$NoPermission +co.xenastudios.xsample.core.common.command.CommandResult$Usage +co.xenastudios.xsample.core.common.command.CommandResult$PlayersOnly +co.xenastudios.xsample.core.common.command.CommandResult$InvalidArgument +co.xenastudios.xsample.core.common.command.CommandResult$Ran +co.xenastudios.xsample.core.common.command.CommandResult$Error +co.xenastudios.xsample.core.common.command.CommandResult$Failed +co.xenastudios.xsample.core.common.command.CommandTreeBuilder +co.xenastudios.xsample.core.common.command.CommandBuilderKt +co.xenastudios.xsample.core.common.command.CommandBuilder +co.xenastudios.xsample.core.common.command.CommandHandler +co.xenastudios.xsample.core.common.command.CommandContext +kotlin.jvm.internal.CollectionToArray +co.xenastudios.xsample.core.common.command.ArgumentTypes +co.xenastudios.xsample.core.common.command.ArgumentTypes$boolean$1 +co.xenastudios.xsample.core.common.command.ArgumentTypes$playerName$1 +co.xenastudios.xsample.core.common.command.ArgumentTypes$playerNameOrUuid$1 +co.xenastudios.xsample.core.common.command.ArgumentTypes$player$1 +co.xenastudios.xsample.core.common.command.Argument +co.xenastudios.xsample.core.common.command.ArgumentTypes$integer$2 +co.xenastudios.xsample.core.common.command.CommandNode +co.xenastudios.xsample.core.common.command.CommandHook +co.xenastudios.xsample.core.common.command.Confirmation +co.xenastudios.xsample.core.common.command.CommandResult$ConfirmNeeded +co.xenastudios.xsample.core.common.command.Cooldown +co.xenastudios.xsample.core.common.command.CommandResult$OnCooldown +co.xenastudios.xsample.core.common.command.CommandTree +co.xenastudios.xsample.core.common.placeholder.PlaceholderBuilder +co.xenastudios.xsample.core.common.placeholder.PlaceholdersKt +co.xenastudios.xsample.core.common.placeholder.PlaceholderSet +co.xenastudios.xsample.core.common.placeholder.Placeholder +co.xenastudios.xsample.core.common.scheduler.SchedulerKt +co.xenastudios.xsample.core.sample.XSample$Interest +co.xenastudios.xsample.core.common.module.ModuleStatus +co.xenastudios.xsample.core.common.module.ModuleStatus$Failed +co.xenastudios.xsample.core.common.module.ModuleContext +kotlin.jvm.functions.Function3 +co.xenastudios.xsample.core.common.module.ModuleSet$start$context$1 +co.xenastudios.xsample.core.common.module.ModuleContext$scheduler$1 +co.xenastudios.xsample.core.common.module.ModuleSet$Running +co.xenastudios.xsample.core.common.module.ModuleContext$ModuleTask +co.xenastudios.xsample.core.bukkit.MainThreadScheduler$MainTask +co.xenastudios.xsample.core.bukkit.modern.Ticks +co.xenastudios.xsample.core.bukkit.AsyncExecutor$AsyncTask +co.xenastudios.xsample.core.common.platform.StorageKt +co.xenastudios.xsample.core.common.config.Configs +co.xenastudios.xsample.bukkit.PlatformCheck +co.xenastudios.xsample.core.common.config.ConfigContext +co.xenastudios.xsample.core.common.scheduler.Where$At +co.xenastudios.xsample.core.common.config.ConfigNotice +co.xenastudios.xsample.core.common.config.ConfigNotice$Kind +co.xenastudios.xsample.core.api.event.EventListener +co.xenastudios.xsample.core.common.config.ConfigLoad +co.xenastudios.xsample.core.common.config.ConfigWriter +kotlin.time.LongSaturatedMathKt +kotlin.text.Charsets +co.xenastudios.xsample.core.api.Location +co.xenastudios.xsample.core.bukkit.BukkitRefs +co.xenastudios.xsample.core.api.WorldRef +co.xenastudios.xsample.core.common.family.FamilyLoad +co.xenastudios.xsample.core.common.family.PlayerStore$None +co.xenastudios.xsample.core.api.WorldRef$Companion +co.xenastudios.xsample.core.api.Pending_jvmKt +co.xenastudios.xsample.core.common.i18n.LanguageTag$Companion +kotlin.uuid.Uuid$Companion +kotlin.sequences.Sequence +kotlin.text.DelimitedRangesSequence +kotlin.jvm.functions.Function2 +kotlin.KotlinNothingValueException +kotlin.uuid.SecureRandomHolder +co.xenastudios.xsample.bukkit.CheckEvent +kotlin.sequences.SequencesKt___SequencesKt$asIterable$$inlined$Iterable$1 +co.xenastudios.xsample.core.api.event.EventType +co.xenastudios.xsample.core.api.event.EventType$Companion +kotlin.text.DelimitedRangesSequence$iterator$1 +co.xenastudios.xsample.core.api.event.Subscription +co.xenastudios.xsample.core.common.event.SimpleEventBus$Entry +kotlin.ranges.ClosedRange +kotlin.ranges.OpenEndRange +kotlin.ranges.IntProgression +kotlin.ranges.IntRange +kotlin.ranges.IntProgression$Companion +kotlin.ranges.IntRange$Companion +kotlin.internal.ProgressionUtilKt +co.xenastudios.xsample.core.jvm.i18n.LangFolder$Companion +kotlin.comparisons.ComparisonsKt__ComparisonsKt +kotlin.comparisons.ComparisonsKt___ComparisonsJvmKt +kotlin.comparisons.ComparisonsKt___ComparisonsKt +kotlin.comparisons.ComparisonsKt +co.xenastudios.xsample.bukkit.PlatformCheck$checkEvents$1 +kotlin.io.ByteStreamsKt +co.xenastudios.xsample.core.bukkit.XenaEvent$Companion +co.xenastudios.xsample.bukkit.PlatformCheck$checkEvents$2 +kotlin.io.CloseableKt +co.xenastudios.xsample.core.common.family.Look +co.xenastudios.xsample.core.common.family.FamilySettingsKt +co.xenastudios.xsample.core.jvm.i18n.LangFolder +co.xenastudios.xsample.core.common.i18n.MessageBundle +co.xenastudios.xsample.core.sample.SampleMessages +co.xenastudios.xsample.core.common.i18n.MarkupTags +co.xenastudios.xsample.core.common.i18n.MarkupTags$Kind +co.xenastudios.xsample.core.common.i18n.CoreMessages +co.xenastudios.xsample.bukkit.PlatformCheck$FakeConsole +co.xenastudios.xsample.core.common.i18n.MessageCatalog$Companion +co.xenastudios.xsample.core.common.i18n.MessageCatalog +co.xenastudios.xsample.core.jvm.db.OnDemandDriverFetcher +co.xenastudios.xsample.core.loader.OnDemandLibraries +it.krzeminski.snakeyaml.engine.kmp.api.lowlevel.Compose +it.krzeminski.snakeyaml.engine.kmp.exceptions.YamlVersionException +co.xenastudios.xsample.core.common.i18n.LangFiles +it.krzeminski.snakeyaml.engine.kmp.api.LoadSettings$CollectionProvider +it.krzeminski.snakeyaml.engine.kmp.api.LoadSettings$SpecVersionMutator +it.krzeminski.snakeyaml.engine.kmp.common.SpecVersion +it.krzeminski.snakeyaml.engine.kmp.schema.SchemaKt +it.krzeminski.snakeyaml.engine.kmp.schema.Schema +it.krzeminski.snakeyaml.engine.kmp.schema.JsonSchema +it.krzeminski.snakeyaml.engine.kmp.schema.CoreSchema +it.krzeminski.snakeyaml.engine.kmp.schema.CoreSchema$Companion +it.krzeminski.snakeyaml.engine.kmp.nodes.Tag +it.krzeminski.snakeyaml.engine.kmp.nodes.Tag$Companion +it.krzeminski.snakeyaml.engine.kmp.common.UriEncoder +net.thauvin.erik.urlencoder.UrlEncoderUtil +it.krzeminski.snakeyaml.engine.kmp.api.ConstructNode +it.krzeminski.snakeyaml.engine.kmp.constructor.ConstructScalar +it.krzeminski.snakeyaml.engine.kmp.constructor.core.ConstructYamlCoreBool +it.krzeminski.snakeyaml.engine.kmp.constructor.ConstructScalar$Companion +it.krzeminski.snakeyaml.engine.kmp.constructor.core.ConstructYamlCoreInt +it.krzeminski.snakeyaml.engine.kmp.exceptions.ConstructorException +it.krzeminski.snakeyaml.engine.kmp.constructor.core.ConstructYamlCoreInt$Companion +it.krzeminski.snakeyaml.engine.kmp.constructor.json.ConstructYamlJsonFloat +it.krzeminski.snakeyaml.engine.kmp.constructor.core.ConstructYamlCoreFloat +it.krzeminski.snakeyaml.engine.kmp.resolver.ScalarResolver +it.krzeminski.snakeyaml.engine.kmp.resolver.BaseScalarResolver +it.krzeminski.snakeyaml.engine.kmp.resolver.CoreScalarResolver +it.krzeminski.snakeyaml.engine.kmp.resolver.BaseScalarResolver$Companion +it.krzeminski.snakeyaml.engine.kmp.resolver.CoreScalarResolver$Companion +it.krzeminski.snakeyaml.engine.kmp.resolver.BaseScalarResolver$ImplicitResolversBuilder +it.krzeminski.snakeyaml.engine.kmp.resolver.ResolverTuple +it.krzeminski.snakeyaml.engine.kmp.schema.JsonSchemaKt +kotlin.collections.builders.MapBuilder$Companion +kotlin.collections.builders.ListBuilderKt +it.krzeminski.snakeyaml.engine.kmp.constructor.ConstructYamlNull +it.krzeminski.snakeyaml.engine.kmp.constructor.json.ConstructYamlJsonBool +it.krzeminski.snakeyaml.engine.kmp.constructor.json.ConstructYamlJsonInt +it.krzeminski.snakeyaml.engine.kmp.constructor.json.ConstructYamlBinary +it.krzeminski.snakeyaml.engine.kmp.schema.JsonSchema_jvmKt +it.krzeminski.snakeyaml.engine.kmp.constructor.json.ConstructUuidClass +it.krzeminski.snakeyaml.engine.kmp.constructor.json.ConstructOptionalClass +kotlin.jvm.internal.markers.KMutableSet +kotlin.collections.AbstractMutableSet +kotlin.collections.builders.AbstractMapBuilderEntrySet +kotlin.collections.builders.MapBuilderEntries +kotlin.jvm.internal.markers.KMutableIterator +kotlin.collections.builders.MapBuilder$Itr +kotlin.collections.builders.MapBuilder$EntriesItr +kotlin.jvm.internal.markers.KMutableMap$Entry +kotlin.collections.builders.MapBuilder$EntryRef +it.krzeminski.snakeyaml.engine.kmp.api.lowlevel.ComposeCommon +okio.Source +okio.BufferedSource +okio.Sink +okio.BufferedSink +okio.Buffer +okio.SegmentPool +okio.Segment +okio.Segment$Companion +it.krzeminski.snakeyaml.engine.kmp.scanner.StreamReader +it.krzeminski.snakeyaml.engine.kmp.exceptions.ReaderException +it.krzeminski.snakeyaml.engine.kmp.scanner.StreamReader$Companion +it.krzeminski.snakeyaml.engine.kmp.parser.Parser +it.krzeminski.snakeyaml.engine.kmp.parser.ParserImpl +it.krzeminski.snakeyaml.engine.kmp.exceptions.ParserException +it.krzeminski.snakeyaml.engine.kmp.parser.ParserImpl$Companion +it.krzeminski.snakeyaml.engine.kmp.scanner.Scanner +it.krzeminski.snakeyaml.engine.kmp.scanner.ScannerImpl +it.krzeminski.snakeyaml.engine.kmp.exceptions.ScannerException +it.krzeminski.snakeyaml.engine.kmp.scanner.ScannerImpl$Companion +it.krzeminski.snakeyaml.engine.kmp.exceptions.Mark +it.krzeminski.snakeyaml.engine.kmp.exceptions.Mark$Companion +kotlin.collections.ArraysKt___ArraysJvmKt$asList$3 +it.krzeminski.snakeyaml.engine.kmp.tokens.Token +it.krzeminski.snakeyaml.engine.kmp.tokens.StreamStartToken +it.krzeminski.snakeyaml.engine.kmp.parser.Production +it.krzeminski.snakeyaml.engine.kmp.parser.ParserImpl$ParseStreamStart +it.krzeminski.snakeyaml.engine.kmp.composer.Composer +it.krzeminski.snakeyaml.engine.kmp.exceptions.ComposerException +it.krzeminski.snakeyaml.engine.kmp.comments.CommentEventsCollector +it.krzeminski.snakeyaml.engine.kmp.comments.CommentType +it.krzeminski.snakeyaml.engine.kmp.comments.EventQueue +it.krzeminski.snakeyaml.engine.kmp.comments.EventQueue$1 +it.krzeminski.snakeyaml.engine.kmp.comments.EventQueue$2 +it.krzeminski.snakeyaml.engine.kmp.internal.utils.MergeUtils +it.krzeminski.snakeyaml.engine.kmp.composer.Composer$mergeUtils$1 +it.krzeminski.snakeyaml.engine.kmp.events.Event +it.krzeminski.snakeyaml.engine.kmp.events.StreamStartEvent +it.krzeminski.snakeyaml.engine.kmp.parser.ParserImpl$ParseImplicitDocumentStart +it.krzeminski.snakeyaml.engine.kmp.events.Event$ID +it.krzeminski.snakeyaml.engine.kmp.tokens.Token$ID +okio.-SegmentedByteString +it.krzeminski.snakeyaml.engine.kmp.internal.utils.CharSequenceExtensionsKt +it.krzeminski.snakeyaml.engine.kmp.internal.utils.Character +it.krzeminski.snakeyaml.engine.kmp.common.CharConstants +it.krzeminski.snakeyaml.engine.kmp.common.CharConstants$Companion +it.krzeminski.snakeyaml.engine.kmp.tokens.CommentToken +it.krzeminski.snakeyaml.engine.kmp.scanner.SimpleKey +it.krzeminski.snakeyaml.engine.kmp.tokens.ScalarToken +it.krzeminski.snakeyaml.engine.kmp.common.ScalarStyle +it.krzeminski.snakeyaml.engine.kmp.tokens.KeyToken +it.krzeminski.snakeyaml.engine.kmp.tokens.BlockMappingStartToken +it.krzeminski.snakeyaml.engine.kmp.tokens.ValueToken +it.krzeminski.snakeyaml.engine.kmp.parser.ParserImpl$ParseDocumentEnd +it.krzeminski.snakeyaml.engine.kmp.parser.ParserImpl$ParseBlockNode +it.krzeminski.snakeyaml.engine.kmp.events.DocumentStartEvent +it.krzeminski.snakeyaml.engine.kmp.parser.ParserImpl$ParseBlockMappingFirstKey +it.krzeminski.snakeyaml.engine.kmp.events.NodeEvent +it.krzeminski.snakeyaml.engine.kmp.events.CollectionStartEvent +it.krzeminski.snakeyaml.engine.kmp.events.MappingStartEvent +it.krzeminski.snakeyaml.engine.kmp.common.FlowStyle +it.krzeminski.snakeyaml.engine.kmp.nodes.CollectionNode +it.krzeminski.snakeyaml.engine.kmp.nodes.MappingNode +it.krzeminski.snakeyaml.engine.kmp.parser.ParserImpl$ParseBlockMappingKey +it.krzeminski.snakeyaml.engine.kmp.parser.ParserImpl$ParseBlockMappingValue +it.krzeminski.snakeyaml.engine.kmp.events.ImplicitTuple +it.krzeminski.snakeyaml.engine.kmp.events.ScalarEvent +it.krzeminski.snakeyaml.engine.kmp.nodes.NodeType +it.krzeminski.snakeyaml.engine.kmp.nodes.NodeTuple +it.krzeminski.snakeyaml.engine.kmp.tokens.BlockEndToken +it.krzeminski.snakeyaml.engine.kmp.tokens.StreamEndToken +it.krzeminski.snakeyaml.engine.kmp.events.CollectionEndEvent +it.krzeminski.snakeyaml.engine.kmp.events.MappingEndEvent +it.krzeminski.snakeyaml.engine.kmp.parser.ParserImpl$ParseDocumentStart +it.krzeminski.snakeyaml.engine.kmp.events.DocumentEndEvent +it.krzeminski.snakeyaml.engine.kmp.events.StreamEndEvent +it.krzeminski.snakeyaml.engine.kmp.nodes.SequenceNode +co.xenastudios.xsample.core.common.config.YamlNode$Mapping$Entry +co.xenastudios.xsample.core.common.i18n.ShippedLanguage +co.xenastudios.xsample.core.common.i18n.LangNotice +co.xenastudios.xsample.core.common.config.Decoder +co.xenastudios.xsample.core.common.i18n.LangNotice$Kind +co.xenastudios.xsample.core.common.i18n.LangLoad +co.xenastudios.xsample.core.common.text.Theme$Companion +co.xenastudios.xsample.core.common.config.Decoder$Result +co.xenastudios.xsample.core.jvm.config.ConfigFile$Companion +co.xenastudios.xsample.core.common.i18n.Translations$Companion +co.xenastudios.xsample.core.common.i18n.Language +co.xenastudios.xsample.core.common.i18n.Formats$Plural +co.xenastudios.xsample.core.common.i18n.Formats$Companion +co.xenastudios.xsample.core.common.i18n.Language$Parsed +co.xenastudios.xsample.core.common.i18n.Translations +co.xenastudios.xsample.core.jvm.i18n.LangFolder$Loaded +co.xenastudios.xsample.bukkit.XSampleBukkit$enable$2$2 diff --git a/gradle/perf-budgets.txt b/gradle/perf-budgets.txt index 4537080f..de2125fa 100644 --- a/gradle/perf-budgets.txt +++ b/gradle/perf-budgets.txt @@ -3,8 +3,8 @@ # The jar budgets are gradle/jar-budgets.txt; the benchmarks' are core/core-benchmarks/budgets.txt. # Startup: the plugin's time on the server thread at every boot (its libraries: resolved by the -# server, onLoad, onEnable), median of the timed boots. The first Xena plugin to start pays for -# loading the Kotlin stdlib's first classes. +# server, or on Paper its paper-plugin.yml loader handing them over; onLoad; onEnable), median of +# the timed boots. The first Xena plugin to start pays for loading the Kotlin stdlib's first classes. startup-first-ms 150 startup-ms 100 diff --git a/scripts/budgets/analyze.py b/scripts/budgets/analyze.py index b6428c3a..be6b9c90 100644 --- a/scripts/budgets/analyze.py +++ b/scripts/budgets/analyze.py @@ -9,7 +9,8 @@ How each number is read (as M0 did, sandbox/m0/budgets/analyze.py): - startup: Paper's "[] Loading N libraries" line to the first line after its "Loaded library" lines (the server resolving libraries:, then making the plugin's class loader and - main class, on the server thread at every boot), plus the onLoad and + main class, on the server thread at every boot), or for a paper-plugin.yml plugin its + loader's time handing Paper its libraries (the shim logs it), plus the onLoad and onEnable times the core's shim logs with -Dxena.startupTimes=true; for a plugin without the shim, its "Loading server plugin" and "Enabling" lines to the next line logged by anything else. The median of the timed boots (every boot but the first, which creates the world). @@ -57,10 +58,14 @@ def startup(path, names): end = next((u for u, _, later in lines[i + 1:] if not later.startswith(f"[{m.group(1)}] Loaded library")), t) result[m.group(1)]["libraries"] += end - t continue - m = re.match(r"Startup times: onLoad ([\d.]+) ms, onEnable ([\d.]+) ms", msg) + m = re.match(r"Startup times: (?:loader ([\d.]+) ms, )?onLoad ([\d.]+) ms, onEnable ([\d.]+) ms", msg) if m and logger in result: - result[logger]["load"] = float(m.group(1)) - result[logger]["enable"] = float(m.group(2)) + # A paper-plugin.yml plugin's loader handing Paper its libraries, which Paper logs + # no line for. (Its class loader and main class aren't in it: about 5 ms, DECISIONS.md.) + if m.group(1) is not None: + result[logger]["libraries"] += float(m.group(1)) + result[logger]["load"] = float(m.group(2)) + result[logger]["enable"] = float(m.group(3)) result[logger]["shim"] = True continue m = re.match(r"(Loading server plugin|Enabling) (\S+) v", msg) diff --git a/scripts/budgets/check.sh b/scripts/budgets/check.sh index 9696b44a..367d53b9 100755 --- a/scripts/budgets/check.sh +++ b/scripts/budgets/check.sh @@ -14,7 +14,7 @@ # # scripts/budgets/check.sh [--version 1.21.11] [--boots 3] [--bots 10] [--idle 60] # [--load 60] [--commands "xsample,coins,pay {other} 1"] [--java ] -# [--out ] [--report-only ,...] plugin.jar... +# [--out ] [--report-only ,...] [--record-startup] plugin.jar... # # Run it after building the jars (./gradlew :core:core-testing:sample:bukkit:assemble for # xSample's shrunk jar in build/r8/). --bots 0 skips the load. The report is /report.md @@ -22,7 +22,10 @@ # build/budgets/ unless given. --report-only names budgets from perf-budgets.txt # (startup-first-ms,startup-ms) that are reported when over, as a warning, but don't fail. # Paper, async-profiler (pinned by SHA-256 below) and the bots' -# packages (npm ci) are fetched on first use and cached in .cache/. +# packages (npm ci) are fetched on first use and cached in .cache/. --record-startup also logs +# the first boot's class loading and writes each plugin's startup class list to +# /startup-classes-.txt (startup_classes.py), to copy to the plugin's project as +# startup-classes.txt. # # Exit codes: 0 every budget met; 1 over a budget (the report says which); 2 a usage error; # 3 the measurement itself failed (a download, the server not starting, the bots not joining), @@ -42,6 +45,7 @@ commands="" java_home="" out="" report_only="" +record_startup=false jars=() while (($#)); do case "$1" in @@ -55,6 +59,7 @@ while (($#)); do --java) java_home=$2; shift 2 ;; --out) out=$2; shift 2 ;; --report-only) report_only=$2; shift 2 ;; + --record-startup) record_startup=true; shift ;; -h | --help) sed -n '2,32p' "$0"; exit 0 ;; -*) echo "unknown option $1" >&2; exit 2 ;; *) [[ -f $1 ]] || { echo "no plugin jar at $1" >&2; exit 2; } @@ -181,12 +186,13 @@ pause-when-empty-seconds=-1 EOF } -# Boots the server in $dir, logging to $1, and waits for it to be up. +# Boots the server in $dir, logging to $1, and waits for it to be up. Further arguments go to the JVM. boot() { log=$1 + shift rm -f "$dir/stdin" mkfifo "$dir/stdin" - (cd "$dir" && exec "$java" -Xms1G -Xmx1G -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints -Dxena.startupTimes=true \ + (cd "$dir" && exec "$java" -Xms1G -Xmx1G -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints -Dxena.startupTimes=true "$@" \ -Dlog4j.configurationFile="$here/log4j2.xml" -Dterminal.jline=false -Dterminal.ansi=false \ -jar "$paper" --nogui "$log" 2>&1) & pid=$! @@ -249,7 +255,15 @@ boot "$out/base-measured.log"; sleep "$settle"; snapshot "$out/base"; stop dir="$out/server" prepare "$dir" "${jars[@]}" echo "== Paper $version with ${names[*]}: first boot (world, configs, libraries)" -boot "$out/boot1.log"; stop +if $record_startup; then + boot "$out/boot1.log" "-Xlog:class+load=info:file=$out/classload.log:uptimemillis"; stop + for i in "${!jars[@]}"; do + python3 "$here/startup_classes.py" --log "$out/classload.log" --boot "$out/boot1.log" --jar "${jars[$i]}" \ + --out "$out/startup-classes-${names[$i]}.txt" + done +else + boot "$out/boot1.log"; stop +fi for ((b = 2; b < boots + 1; b++)); do echo "== timed boot $b of $((boots + 1))" boot "$out/boot$b.log"; sleep 2; stop diff --git a/scripts/budgets/startup_classes.py b/scripts/budgets/startup_classes.py new file mode 100644 index 00000000..eeaa8487 --- /dev/null +++ b/scripts/budgets/startup_classes.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +"""Writes a plugin's startup class list from a boot's class-loading log, for build-logic's R8Shrink +(xenaR8's startupClasses: the project's startup-classes.txt), which maps it to the shrunk jar's +names. scripts/budgets/check.sh --record-startup runs it after a boot with +-Xlog:class+load=info:file=:uptimemillis. + + startup_classes.py --log classload.log --boot boot.log --jar Plugin.jar --out startup-classes.txt + +Kept: every class loaded before the server's "Done (" line from the plugin's jar or from a +library its META-INF/xena/libraries.txt lists (from plugins/Xena/libraries/, or the server's +libraries/ for libraries:), the jar's +own back in the names they have before R8 (the mapping file beside the jar), in the order they +loaded, which is the order the shim loads them in. +""" +import argparse +import os +import re +import zipfile + +ap = argparse.ArgumentParser() +ap.add_argument("--log", required=True) +ap.add_argument("--boot", required=True) +ap.add_argument("--jar", required=True) +ap.add_argument("--out", required=True) +a = ap.parse_args() + +done = None +for line in open(a.boot, errors="replace"): + m = re.match(r"^(\d+) .*Done \(", line) + if m: + done = int(m.group(1)) + break +if done is None: + raise SystemExit(f"no Done line in {a.boot}") + +original = {} +mapping = os.path.splitext(a.jar)[0] + ".map" +if os.path.isfile(mapping): + for line in open(mapping): + m = re.match(r"^(\S+) -> (\S+):$", line.rstrip("\n")) + if m: + original[m.group(2)] = m.group(1) + +jar_name = os.path.basename(a.jar) +# The libraries' jars, by their path in a Maven layout (the family's cache and the server's +# libraries/ both use one): org/jetbrains/kotlin/kotlin-stdlib/2.4.21/kotlin-stdlib-2.4.21.jar. +with zipfile.ZipFile(a.jar) as z: + listed = z.read("META-INF/xena/libraries.txt").decode() if "META-INF/xena/libraries.txt" in z.namelist() else "" +libraries = [] +for line in listed.splitlines(): + parts = line.split() + if len(parts) >= 2 and parts[0].count(":") == 2: + group, artifact, version = parts[0].split(":") + libraries.append(f"/{group.replace('.', '/')}/{artifact}/{version}/{artifact}-{version}.jar") +names = [] +seen = set() +for line in open(a.log, errors="replace"): + m = re.match(r"^\[(\d+)ms\](?:\[info\]\[class,load\])? (\S+) source: (.*)$", line.rstrip("\n")) + if not m or int(m.group(1)) > done: + continue + name, source = m.group(2), m.group(3) + ours = jar_name in source + library = any(path in source for path in libraries) + if not (ours or library) or "$$Lambda" in name or "/0x" in name: + continue + name = original.get(name, name) if ours else name + if name not in seen: + seen.add(name) + names.append(name) + +with open(a.out, "w") as f: + f.write("# The classes this plugin loads as it starts, recorded on Paper by scripts/budgets/check.sh\n") + f.write("# --record-startup: the shim loads them on a thread of its own before onEnable (DECISIONS.md).\n") + f.write("# In their names before R8; R8Shrink maps them. Record again after big changes.\n") + for name in names: + f.write(name + "\n") +print(f"{len(names)} startup classes -> {a.out}")