{"id":19653269,"url":"https://github.com/florianmichael/dietrichevents2","last_synced_at":"2025-04-28T17:31:22.461Z","repository":{"id":177340403,"uuid":"658750705","full_name":"FlorianMichael/DietrichEvents2","owner":"FlorianMichael","description":"One of the fastest Java event systems in the world using compiler optimizations, which still has a lot of features","archived":false,"fork":false,"pushed_at":"2025-04-26T14:26:08.000Z","size":341,"stargazers_count":20,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-26T15:30:04.734Z","etag":null,"topics":["event","event-management","eventbus","events","java","lambda","listener"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FlorianMichael.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"FlorianMichael","custom":["https://florianmichael.de/donate"]}},"created_at":"2023-06-26T12:19:12.000Z","updated_at":"2025-04-26T14:26:12.000Z","dependencies_parsed_at":"2024-01-01T01:22:13.968Z","dependency_job_id":"a0ad0e70-7fc0-4eb2-b385-2afd56dc6e5f","html_url":"https://github.com/FlorianMichael/DietrichEvents2","commit_stats":null,"previous_names":["florianmichael/dietrichevents2"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorianMichael%2FDietrichEvents2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorianMichael%2FDietrichEvents2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorianMichael%2FDietrichEvents2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorianMichael%2FDietrichEvents2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FlorianMichael","download_url":"https://codeload.github.com/FlorianMichael/DietrichEvents2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251355373,"owners_count":21576344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["event","event-management","eventbus","events","java","lambda","listener"],"created_at":"2024-11-11T15:13:44.360Z","updated_at":"2025-04-28T17:31:22.150Z","avatar_url":"https://github.com/FlorianMichael.png","language":"Java","funding_links":["https://github.com/sponsors/FlorianMichael","https://florianmichael.de/donate"],"categories":[],"sub_categories":[],"readme":"# DietrichEvents2\nOne of the fastest Java event systems in the world using compiler optimizations, which still has a lot of features\n\n## Contact\nIf you encounter any issues, please report them on the\n[issue tracker](https://github.com/FlorianMichael/DietrichEvents2/issues).  \nIf you just want to talk or need help with DietrichEvents2 feel free to join my\n[Discord](https://discord.gg/BwWhCHUKDf).\n\n## How to add this to your project\n### Gradle/Maven\nTo use DietrichEvents2 with Gradle/Maven you can use [Maven Central](https://mvnrepository.com/artifact/de.florianmichael/DietrichEvents2), [Lenni0451's Maven](https://maven.lenni0451.net/#/releases/de/florianmichael/DietrichEvents2) or [Jitpack](https://jitpack.io/#FlorianMichael/DietrichEvents2).  \nYou can also find instructions how to implement it into your build script there.\n\n### Jar File\nIf you just want the latest jar file you can download it from the GitHub [Actions](https://github.com/FlorianMichael/DietrichEvents2/actions) or use the [Release](https://github.com/FlorianMichael/DietrichEvents2/releases).\n\n## Example usage\n### Create instance\nYou can use either **new DietrichEvents2(exception -\u003e {});** or **DietrichEvents2.global()** to access an instance of\nthe EventSystem,\n\n### Create an Event\n```java\npublic interface ExampleListener {\n\n    void onTest(final String example);\n\n    class ExampleEvent extends AbstractEvent\u003cExampleListener\u003e {\n\n        /**\n         * The ID has to be incremented for every new Event\n         */\n        public static final int ID = 0;\n        public final String example;\n\n        public ExampleEvent(final String example) {\n            this.example = example;\n        }\n\n        @Override\n        public void call(ExampleListener listener) {\n            listener.onTest(example);\n        }\n    }\n}\n```\n\n### Register Listener\n```java\npublic class Test implements ExampleListener {\n\n    public void begin() {\n        DietrichEvents2.global().subscribe(ExampleEvent.ID, this);\n    }\n\n    @Override\n    public void onTest(String example) {\n        System.out.println(\"Executed once!\");\n        DietrichEvents2.global().unsubscribe(ExampleEvent.ID, this);\n    }\n}\n```\n\n### Calling an Event\n````java\n// There are multiple call methods which can be used depending on the situation:\n\n// - callUnsafe() -\u003e Calls the event without any sanity\n\n// - callExceptionally() -\u003e Calls the event without error handling\n\n// - call() -\u003e Calls the event with global error handling\n\n// - callBreakable() -\u003e Calls the event with error handling for every listener and supports\n// BreakableException to be thrown (also does resize)\n\nDietrichEvents2.global().call(ExampleEvent.ID, new ExampleEvent(\"Hello World!\"));\n````\n\n## JMH Benchmark\nThe Benchmark shows the average time it takes to call an event 100.000 times.\nAll Benchmarks are run with the same code (see **src/jmh/java**), but different Java versions. If an event system does\nnot appear in every list, it does not exist for the particular Java version, or would not work without modifying\nit. \u003cbr\u003e\n\n### Hardware specification:\n- CPU: Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz\n- RAM: 48,0GB DDR4\n- GPU: NVIDIA GeForce RTX 3070 Ti\n- OS: Windows 11 Home 22H2 (Build 22621.1992)\n\nIf you want to have another event system in the list, or want to have the source code to generate the tables, you can\nwrite me on Discord, look for it at \"Contact\" above. \u003cbr\u003e\n\n### Java 17\n| Benchmark                                                                                                               | Mode | Cnt | Score        | Error      | Units |\n|-------------------------------------------------------------------------------------------------------------------------|------|-----|--------------|------------|-------|\n| [DietrichEvents2](https://github.com/FlorianMichael/DietrichEvents2)                                                    | avgt | 4   | 310318,125   | 124933,800 | ns/op |\n| [ASMEvents](https://github.com/Lenni0451/ASMEvents)                                                                     | avgt | 4   | 546376,840   | 18561,729  | ns/op |\n| [ChimeraEventBus](https://github.com/FelixH2012/ChimeraEventBus)                                                        | avgt | 4   | 581672,678   | 71045,952  | ns/op |\n| [norbit](https://github.com/CrosbyDev/norbit)                                                                           | avgt | 4   | 604412,122   | 28715,740  | ns/op |\n| [DietrichEvents](https://github.com/FlorianMichael/DietrichEvents)                                                      | avgt | 4   | 627457,818   | 12842,704  | ns/op |\n| [EventAPI](https://github.com/Lenni0451/EventAPI) (MinimalEventManager)                                                 | avgt | 4   | 769492,673   | 18975,650  | ns/op |\n| [DarkMagician6](https://bitbucket.org/DarkMagician6/eventapi/src/master/)                                               | avgt | 4   | 1020463,350  | 70117,174  | ns/op |\n| [LambdaEvents](https://github.com/Lenni0451/LambdaEvents) (LambdaMetaFactory)                                           | avgt | 4   | 1134071,045  | 41718,145  | ns/op |\n| [LambdaEvents](https://github.com/Lenni0451/LambdaEvents) (Method Handles)                                              | avgt | 4   | 1593772,392  | 66639,866  | ns/op |\n| [LambdaEvents](https://github.com/Lenni0451/LambdaEvents) (Reflection)                                                  | avgt | 4   | 2164632,230  | 49576,755  | ns/op |\n| [Cydhra](https://github.com/Cydhra/EventSystem/tree/master) (Event System)                                              | avgt | 4   | 5169086,080  | 58597,729  | ns/op |\n| [EventAPI](https://github.com/Lenni0451/EventAPI) (EventManager)                                                        | avgt | 4   | 6735240,280  | 221306,805 | ns/op |\n| [Guava](https://github.com/google/guava)                                                                                | avgt | 4   | 15337145,465 | 247949,530 | ns/op |\n\n### Java 11\n| Benchmark                                                                                                               | Mode | Cnt | Score        | Error      | Units |\n|-------------------------------------------------------------------------------------------------------------------------|------|-----|--------------|------------|-------|\n| [DietrichEvents2](https://github.com/FlorianMichael/DietrichEvents2)                                                    | avgt | 4   | 415349,165   | 7314,048   | ns/op |\n| [ASMEvents](https://github.com/Lenni0451/ASMEvents)                                                                     | avgt | 4   | 663676,846   | 16997,570  | ns/op |\n| [ChimeraEventBus](https://github.com/FelixH2012/ChimeraEventBus)                                                        | avgt | 4   | 710557,890   | 72090,826  | ns/op |\n| [DietrichEvents](https://github.com/FlorianMichael/DietrichEvents)                                                      | avgt | 4   | 743307,467   | 18786,064  | ns/op |\n| [DarkMagician6](https://bitbucket.org/DarkMagician6/eventapi/src/master/)                                               | avgt | 4   | 753029,999   | 16373,710  | ns/op |\n| [EventAPI](https://github.com/Lenni0451/EventAPI) (MinimalEventManager)                                                 | avgt | 4   | 770001,532   | 24463,218  | ns/op |\n| [EventAPI](https://github.com/Lenni0451/EventAPI) (ASMEventManager)                                                     | avgt | 4   | 771670,427   | 13801,284  | ns/op |\n| [LambdaEvents](https://github.com/Lenni0451/LambdaEvents) (LambdaMetaFactory)                                           | avgt | 4   | 1130460,687  | 30560,981  | ns/op |\n| [LambdaEvents](https://github.com/Lenni0451/LambdaEvents) (Method Handles)                                              | avgt | 4   | 1504976,295  | 69021,509  | ns/op |\n| [LambdaEvents](https://github.com/Lenni0451/LambdaEvents) (Reflection)                                                  | avgt | 4   | 2205444,424  | 337975,180 | ns/op |\n| [EventAPI](https://github.com/Lenni0451/EventAPI) (InjectionEventManager)                                               | avgt | 4   | 3015519,829  | 44426,039  | ns/op |\n| [EventAPI](https://github.com/Lenni0451/EventAPI) (EventManager)                                                        | avgt | 4   | 5504772,250  | 46947,848  | ns/op |\n| [Cydhra](https://github.com/Cydhra/EventSystem/tree/master) (Event System)                                              | avgt | 4   | 5794477,294  | 113790,263 | ns/op |\n| [Guava](https://github.com/google/guava)                                                                                | avgt | 4   | 11656575,419 | 533926,166 | ns/op |\n\n### Java 8\n| Benchmark                                                                                                               | Mode | Cnt | Score        | Error      | Units |\n|-------------------------------------------------------------------------------------------------------------------------|------|-----|--------------|------------|-------|\n| [DietrichEvents2](https://github.com/FlorianMichael/DietrichEvents2)                                                    | avgt | 4   | 635392,941   | 25647,033  | ns/op |\n| [ASMEvents](https://github.com/Lenni0451/ASMEvents)                                                                     | avgt | 4   | 813149,931   | 31763,759  | ns/op |\n| [LambdaEvents](https://github.com/Lenni0451/LambdaEvents) (LambdaMetaFactory)                                           | avgt | 4   | 1129216,906  | 16383,663  | ns/op |\n| [EventAPI](https://github.com/Lenni0451/EventAPI) (MinimalEventManager)                                                 | avgt | 4   | 1327251,543  | 55359,321  | ns/op |\n| [EventAPI](https://github.com/Lenni0451/EventAPI) (ASMEventManager)                                                     | avgt | 4   | 1399196,527  | 55170,229  | ns/op |\n| [LambdaEvents](https://github.com/Lenni0451/LambdaEvents) (Method Handles)                                              | avgt | 4   | 1495215,777  | 6336,098   | ns/op |\n| [DietrichEvents](https://github.com/FlorianMichael/DietrichEvents)                                                      | avgt | 4   | 1497398,449  | 128637,113 | ns/op |\n| [DarkMagician6](https://bitbucket.org/DarkMagician6/eventapi/src/master/)                                               | avgt | 4   | 1870394,664  | 59848,353  | ns/op |\n| [LambdaEvents](https://github.com/Lenni0451/LambdaEvents) (Reflection)                                                  | avgt | 4   | 2169950,957  | 50804,811  | ns/op |\n| [EventAPI](https://github.com/Lenni0451/EventAPI) (InjectionEventManager)                                               | avgt | 4   | 3832627,003  | 73982,528  | ns/op |\n| [EventAPI](https://github.com/Lenni0451/EventAPI) (EventManager)                                                        | avgt | 4   | 5963389,296  | 956568,797 | ns/op |\n| [Cydhra](https://github.com/Cydhra/EventSystem/tree/master) (Event System)                                              | avgt | 4   | 7357398,698  | 92774,097  | ns/op |\n| [Guava](https://github.com/google/guava)                                                                                | avgt | 4   | 11945301,707 | 239846,530 | ns/op |\n\nDate of the benchmark: 2023-07-17\n\n*This table is not meant to put others down, but simply to support the main message of this event system.*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorianmichael%2Fdietrichevents2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflorianmichael%2Fdietrichevents2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorianmichael%2Fdietrichevents2/lists"}