{"id":69359,"date":"2026-06-04T01:53:02","date_gmt":"2026-06-03T22:53:02","guid":{"rendered":"https:\/\/vpesports.com\/minecraft\/mods\/fastevent\/"},"modified":"2026-06-04T01:53:02","modified_gmt":"2026-06-03T22:53:02","slug":"fastevent","status":"publish","type":"mod","link":"https:\/\/vpesports.com\/minecraft\/mods\/fastevent\/","title":{"rendered":"FastEvent"},"content":{"rendered":"<p>## Project Abandoned<\/p>\n<p>Long story short, the optimization approach still applies, but Forge\/NeoForge does not allow mod to modify EventBus.<\/p>\n<p>Unlike classes from Minecraft or Forge itself, EventBus is loaded not as part of the game, but as &#8220;library&#8221;, which makes it impossible to modify EventBus via Mixin or Transformer.<\/p>\n<p>In 1.2.0, in an effort of further improving performance, I used some dirty hack (or &#8220;non-standard approach&#8221; if you prefer) to modify the `ASMEventHandler` class, which is unfortunately broken in 1.18.2+. These releases are archived now, and are likely not receiving further update.<\/p>\n<p>## FastEvent<\/p>\n<p>is a Forge\/Neoforge optimization mod that optimizes one of the most fundamental systems in Forge: the Event system.<\/p>\n<p>## How Fast<\/p>\n<p>It&#8217;s not easy to make a test case for every supported Minecraft version, especially when the Event system for these versions are different from each other. So instead, I will provide a JMH benchmark report from a PR I made for Cleanroom project, in which I used the same optimization approach as FastEvent:<\/p>\n<p>### Register 10,000 event listeners, post event 0 times:<\/p>\n<p>&#8220;`<br \/>\nBenchmark                               Mode  Cnt     Score     Error  Units<br \/>\nBusPerformanceTest.register10000Legacy  avgt    5  1126.498 \u00b1 284.633  ms\/op<br \/>\nBusPerformanceTest.register10000Modern  avgt    5  1058.961 \u00b1 173.586  ms\/op<br \/>\n&#8220;`<\/p>\n<p>About 6.4% faster.<\/p>\n<p>### Register 1,000 event listeners, post event 10,000 times:<\/p>\n<p>&#8220;`<br \/>\nBenchmark                                       Mode  Cnt     Score      Error  Units<br \/>\nBusPerformanceTest.register1000test10000Legacy  avgt    5  4407.963 \u00b1 4250.643  ms\/op<br \/>\nBusPerformanceTest.register1000test10000Modern  avgt    5  3550.578 \u00b1 1991.352  ms\/op<br \/>\n&#8220;`<\/p>\n<p>About 24% faster.<\/p>\n<p>### Original PR<\/p>\n<p>https:\/\/github.com\/CleanroomMC\/Cleanroom\/pull\/328#issuecomment-2801099504<\/p>\n<p>## How does it work<\/p>\n<p>(Nerdy technical details alert)<\/p>\n<p>When devs are using `@EventBusSubscriber` and\/or `@SubscribeEvent` to subscribe event handlers, the EventBus cannot get the event handler magically, instead only a `Method` object is available. So the most straight-forward approach is use this object directly: `method.invoke(&#8230;)`. This invocation will eventually be redirected by JVM back to the original method, allowing an event handler to receive an event after subscribing to it.<\/p>\n<p>But this (`method.invoke(&#8230;)`) is really slow. To make it faster, the EventBus will, at runtime, generate event handler classes for every method it found, eliminating expensive reflection based invocation.<\/p>\n<p>But generating classes introduces another slow-down. To make it even faster, FastEvent replaced class generation with lambda construction, speeding up event handler construction. Another benefit is that lambda is &#8220;hidden&#8221;, allowing JVM to perform more optimization.<\/p>\n<p>If you happen to know a bit Java, code examples below might be more intuitive for you:<\/p>\n<p>&#8220;`java<br \/>\nclass Listen {<br \/>\n    public void onEvent(Event event) {<br \/>\n    }<br \/>\n}<br \/>\nListen lis = new Listen();<\/p>\n<p>\/\/ EventBus will generate a new class for every event handler<br \/>\nclass IEventListener$Listen$onEvent implements IEventListener {<br \/>\n    private Listen instance;<br \/>\n    public IEventListener$Listen$onEvent(Listen instance) {<br \/>\n        this.instance = instance;<br \/>\n    }<br \/>\n    @Override<br \/>\n    public void invoke(Event event) {<br \/>\n        instance.onEvent(event);<br \/>\n    }<br \/>\n}<br \/>\nIEventListener handler = new IEventListener$Listen$onEvent(lis);<\/p>\n<p>\/\/ FastEvent uses lambda to generate event handler<br \/>\nIEventListener handler = lis::onEvent;<br \/>\n&#8220;`<\/p>\n","protected":false},"excerpt":{"rendered":"<p>speeding up the Event system in Forge\/NeoForge<\/p>\n","protected":false},"featured_media":69360,"template":"","meta":{"_minecraft_slug":"fastevent","_minecraft_project_id":"LauZQ6kM","_minecraft_author":"ZZZank","_minecraft_license":"MIT","_minecraft_downloads":1117164,"_minecraft_follows":30,"_minecraft_client_side":"optional","_minecraft_server_side":"optional","_minecraft_storage_type":"zip","_minecraft_archive_name":"fastevent.zip","_minecraft_size_bytes":381098,"_minecraft_version_count":12,"_minecraft_updated_at":"2026-05-16T12:41:55.995348Z","_minecraft_date_created":"2025-05-12T02:14:45.260296Z","_minecraft_date_modified":"2025-06-18T05:46:24.321394Z","_minecraft_project_url":"https:\/\/modrinth.com\/mod\/fastevent","_minecraft_icon_attachment_id":69360,"_minecraft_imported_at":"2026-06-03T22:53:03+00:00","_minecraft_import_hash":"34f9528354c9fdf49ebe9ebf7b3e952e","_minecraft_versions":"","_minecraft_links":"","_minecraft_gallery":"","_minecraft_api_metadata":""},"mod_category":[104,158,90],"mod_loader":[106,160],"minecraft_version":[48,53,56,36,37],"class_list":["post-69359","mod","type-mod","status-publish","has-post-thumbnail","hentry","mod_category-forge","mod_category-neoforge","mod_category-optimization","mod_loader-forge","mod_loader-neoforge","minecraft_version-1-16-5","minecraft_version-1-18-2","minecraft_version-1-19-2","minecraft_version-1-20-1","minecraft_version-1-21-1"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>FastEvent - Minecraft<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vpesports.com\/minecraft\/mods\/fastevent\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FastEvent - Minecraft\" \/>\n<meta property=\"og:description\" content=\"speeding up the Event system in Forge\/NeoForge\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vpesports.com\/minecraft\/mods\/fastevent\/\" \/>\n<meta property=\"og:site_name\" content=\"Minecraft\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/fastevent\\\/\",\"url\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/fastevent\\\/\",\"name\":\"FastEvent - Minecraft\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/fastevent\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/fastevent\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/wp-content\\\/uploads\\\/2026\\\/06\\\/fastevent-icon-0f562a421a15bee9ed8deeea99b24b3abe233b01_96.webp\",\"datePublished\":\"2026-06-03T22:53:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/fastevent\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/fastevent\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/fastevent\\\/#primaryimage\",\"url\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/wp-content\\\/uploads\\\/2026\\\/06\\\/fastevent-icon-0f562a421a15bee9ed8deeea99b24b3abe233b01_96.webp\",\"contentUrl\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/wp-content\\\/uploads\\\/2026\\\/06\\\/fastevent-icon-0f562a421a15bee9ed8deeea99b24b3abe233b01_96.webp\",\"width\":96,\"height\":96},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/fastevent\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Mods\",\"item\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/mods\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"FastEvent\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/#website\",\"url\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/\",\"name\":\"Minecraft\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/vpesports.com\\\/minecraft\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"FastEvent - Minecraft","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vpesports.com\/minecraft\/mods\/fastevent\/","og_locale":"en_US","og_type":"article","og_title":"FastEvent - Minecraft","og_description":"speeding up the Event system in Forge\/NeoForge","og_url":"https:\/\/vpesports.com\/minecraft\/mods\/fastevent\/","og_site_name":"Minecraft","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/vpesports.com\/minecraft\/mods\/fastevent\/","url":"https:\/\/vpesports.com\/minecraft\/mods\/fastevent\/","name":"FastEvent - Minecraft","isPartOf":{"@id":"https:\/\/vpesports.com\/minecraft\/#website"},"primaryImageOfPage":{"@id":"https:\/\/vpesports.com\/minecraft\/mods\/fastevent\/#primaryimage"},"image":{"@id":"https:\/\/vpesports.com\/minecraft\/mods\/fastevent\/#primaryimage"},"thumbnailUrl":"https:\/\/vpesports.com\/minecraft\/wp-content\/uploads\/2026\/06\/fastevent-icon-0f562a421a15bee9ed8deeea99b24b3abe233b01_96.webp","datePublished":"2026-06-03T22:53:02+00:00","breadcrumb":{"@id":"https:\/\/vpesports.com\/minecraft\/mods\/fastevent\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vpesports.com\/minecraft\/mods\/fastevent\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vpesports.com\/minecraft\/mods\/fastevent\/#primaryimage","url":"https:\/\/vpesports.com\/minecraft\/wp-content\/uploads\/2026\/06\/fastevent-icon-0f562a421a15bee9ed8deeea99b24b3abe233b01_96.webp","contentUrl":"https:\/\/vpesports.com\/minecraft\/wp-content\/uploads\/2026\/06\/fastevent-icon-0f562a421a15bee9ed8deeea99b24b3abe233b01_96.webp","width":96,"height":96},{"@type":"BreadcrumbList","@id":"https:\/\/vpesports.com\/minecraft\/mods\/fastevent\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vpesports.com\/minecraft\/"},{"@type":"ListItem","position":2,"name":"Mods","item":"https:\/\/vpesports.com\/minecraft\/mods\/"},{"@type":"ListItem","position":3,"name":"FastEvent"}]},{"@type":"WebSite","@id":"https:\/\/vpesports.com\/minecraft\/#website","url":"https:\/\/vpesports.com\/minecraft\/","name":"Minecraft","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vpesports.com\/minecraft\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/mod\/69359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/mod"}],"about":[{"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/types\/mod"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/media\/69360"}],"wp:attachment":[{"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/media?parent=69359"}],"wp:term":[{"taxonomy":"mod_category","embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/mod_category?post=69359"},{"taxonomy":"mod_loader","embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/mod_loader?post=69359"},{"taxonomy":"minecraft_version","embeddable":true,"href":"https:\/\/vpesports.com\/minecraft\/wp-json\/wp\/v2\/minecraft_version?post=69359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}