Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide explicit-class alternative for all addListener methods #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gigaherz
Copy link
Contributor

@gigaherz gigaherz commented Apr 9, 2021

Adds variants with explicit event class to all addListener and addGenericListener methods that didn't already have them.
Marks all the overloads without an event class parameter deprecated.
Updates all tests to prefer the new overloads.

@gigaherz
Copy link
Contributor Author

I finally managed to run JMH on my computer (Windows 10).

Setup:

cd /D C:\
mklink /d forgedev F:\Modding\Forge
cd forgedev
cd eventbus

Java 8:

Execution:

set JAVA_HOME=c:\java\jdk-8u282-b08
gradlew jmh

Results:

Benchmark                                 Mode  Cnt   Score   Error  Units
EventBusBenchmark.testClassLambda         avgt    9  41.839 ± 5.051  ns/op
EventBusBenchmark.testClassLambda:·stack  avgt          NaN            ---
EventBusBenchmark.testDynamic             avgt    9  38.431 ± 0.933  ns/op
EventBusBenchmark.testDynamic:·stack      avgt          NaN            ---
EventBusBenchmark.testLambda              avgt    9  38.590 ± 4.967  ns/op
EventBusBenchmark.testLambda:·stack       avgt          NaN            ---
EventBusBenchmark.testStatic              avgt    9  34.296 ± 0.097  ns/op
EventBusBenchmark.testStatic:·stack       avgt          NaN            ---

Java 11:

Execution:

set JAVA_HOME="c:\java\jdk-11.0.10+9"
gradlew jmh

Results:

Benchmark                                 Mode  Cnt   Score   Error  Units
EventBusBenchmark.testClassLambda         avgt    9  39.551 ± 0.417  ns/op
EventBusBenchmark.testClassLambda:·stack  avgt          NaN            ---
EventBusBenchmark.testDynamic             avgt    9  41.563 ± 1.988  ns/op
EventBusBenchmark.testDynamic:·stack      avgt          NaN            ---
EventBusBenchmark.testLambda              avgt    9  39.230 ± 0.603  ns/op
EventBusBenchmark.testLambda:·stack       avgt          NaN            ---
EventBusBenchmark.testStatic              avgt    9  38.259 ± 0.856  ns/op
EventBusBenchmark.testStatic:·stack       avgt          NaN            ---

As expected, removing typetools makes no significant difference in performance, since all it's used for is resolving the generic type.

@gigaherz gigaherz force-pushed the typetools-deprecation branch 2 times, most recently from 62ed54e to 35a3509 Compare June 2, 2021 18:03
@gigaherz gigaherz changed the title Deprecate TypeTools usages Provide explicit-class alternative for all addListener methods Jun 2, 2021
…s parameters.

Add test variants for explicit-class handlers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant