Last active
July 14, 2020 02:14
-
-
Save KengoTODA/3812d68112ee873b83120d44f7714a7d to your computer and use it in GitHub Desktop.
microbench for https://jira.qos.ch/browse/SLF4J-450
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macOS Catalina 10.15.4 (19E287) | |
openjdk 11.0.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | single binding with ServiceLoader [s] | single binding with system property [s] | multiple bindings with ServiceLoader[s] | multiple bindings with system property [s] | |
---|---|---|---|---|---|
1 | 0.14 | 0.12 | 0.13 | 0.11 | |
2 | 0.13 | 0.12 | 0.13 | 0.11 | |
3 | 0.13 | 0.12 | 0.14 | 0.11 | |
4 | 0.14 | 0.13 | 0.14 | 0.11 | |
5 | 0.14 | 0.12 | 0.16 | 0.14 | |
6 | 0.13 | 0.11 | 0.14 | 0.11 | |
7 | 0.12 | 0.12 | 0.13 | 0.11 | |
8 | 0.13 | 0.12 | 0.13 | 0.11 | |
9 | 0.12 | 0.13 | 0.14 | 0.11 | |
10 | 0.13 | 0.13 | 0.13 | 0.11 | |
11 | 0.13 | 0.13 | 0.14 | 0.11 | |
12 | 0.13 | 0.14 | 0.16 | 0.11 | |
13 | 0.13 | 0.12 | 0.15 | 0.11 | |
14 | 0.12 | 0.12 | 0.13 | 0.11 | |
15 | 0.14 | 0.11 | 0.13 | 0.11 | |
16 | 0.14 | 0.12 | 0.13 | 0.11 | |
17 | 0.14 | 0.12 | 0.13 | 0.11 | |
18 | 0.13 | 0.14 | 0.13 | 0.15 | |
19 | 0.14 | 0.13 | 0.14 | 0.13 | |
20 | 0.13 | 0.11 | 0.13 | 0.12 | |
21 | 0.14 | 0.11 | 0.13 | 0.11 | |
22 | 0.12 | 0.11 | 0.13 | 0.11 | |
23 | 0.13 | 0.11 | 0.13 | 0.11 | |
24 | 0.14 | 0.10 | 0.13 | 0.11 | |
25 | 0.13 | 0.11 | 0.13 | 0.11 | |
26 | 0.12 | 0.10 | 0.13 | 0.12 | |
27 | 0.13 | 0.11 | 0.13 | 0.11 | |
28 | 0.13 | 0.11 | 0.13 | 0.11 | |
29 | 0.13 | 0.11 | 0.13 | 0.11 | |
30 | 0.13 | 0.11 | 0.13 | 0.11 | |
31 | 0.13 | 0.11 | 0.13 | 0.11 | |
32 | 0.15 | 0.11 | 0.13 | 0.11 | |
33 | 0.13 | 0.10 | 0.13 | 0.11 | |
34 | 0.13 | 0.11 | 0.12 | 0.11 | |
35 | 0.13 | 0.11 | 0.13 | 0.11 | |
36 | 0.12 | 0.11 | 0.13 | 0.11 | |
37 | 0.13 | 0.11 | 0.13 | 0.11 | |
38 | 0.13 | 0.10 | 0.14 | 0.11 | |
39 | 0.13 | 0.10 | 0.13 | 0.11 | |
40 | 0.14 | 0.10 | 0.13 | 0.11 | |
Median | 0.13 | 0.11 | 0.13 | 0.11 | |
90 percentile | 0.14 | 0.13 | 0.14 | 0.12 | |
95 percentile | 0.14 | 0.1305 | 0.1505 | 0.1305 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
cat <<EOF > Main.java | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
public class Main { | |
public static void main(String... args) { | |
Logger logger = LoggerFactory.getLogger(Main.class); | |
logger.info("hello!"); | |
} | |
} | |
EOF | |
java --version | |
javac -cp ~/GitHub/slf4j/slf4j-api/target/slf4j-api-2.0.0-alpha2-SNAPSHOT.jar Main.java | |
echo | |
echo single binding with ServiceLoader | |
for i in {1..20}; do | |
/usr/bin/time java -Xmx128m -Xms128m \ | |
-classpath /Users/kengo/GitHub/slf4j/slf4j-api/target/slf4j-api-2.0.0-alpha2-SNAPSHOT.jar:/Users/kengo/GitHub/slf4j/slf4j-nop/target/slf4j-nop-2.0.0-alpha2-SNAPSHOT.jar:/Users/kengo/GitHub/spotbugs/spotbugs/build/libs/spotbugs.jar:. \ | |
Main \ | |
2>&1|grep real | sed 's/ \{1,\}/ /g' | cut -d ' ' -f 2 | |
done; | |
echo | |
echo single binding with system property | |
for i in {1..20}; do | |
/usr/bin/time java -Xmx128m -Xms128m \ | |
-Dslf4j.binding=org.slf4j.helpers.NOPServiceProvider \ | |
-classpath /Users/kengo/GitHub/slf4j/slf4j-api/target/slf4j-api-2.0.0-alpha2-SNAPSHOT.jar:/Users/kengo/GitHub/slf4j/slf4j-nop/target/slf4j-nop-2.0.0-alpha2-SNAPSHOT.jar:/Users/kengo/GitHub/spotbugs/spotbugs/build/libs/spotbugs.jar:. \ | |
Main \ | |
2>&1| grep real | sed 's/ \{1,\}/ /g' | cut -d ' ' -f 2 | |
done; | |
echo | |
echo multiple bindings with ServiceLoader | |
for i in {1..20}; do | |
/usr/bin/time java -Xmx128m -Xms128m \ | |
-classpath /Users/kengo/GitHub/slf4j/slf4j-api/target/slf4j-api-2.0.0-alpha2-SNAPSHOT.jar:/Users/kengo/GitHub/slf4j/slf4j-nop/target/slf4j-nop-2.0.0-alpha2-SNAPSHOT.jar:/Users/kengo/GitHub/slf4j/slf4j-jdk14/target/slf4j-jdk14-2.0.0-alpha2-SNAPSHOT.jar:/Users/kengo/GitHub/slf4j/slf4j-simple/target/slf4j-simple-2.0.0-alpha2-SNAPSHOT.jar:/Users/kengo/GitHub/spotbugs/spotbugs/build/libs/spotbugs.jar:. \ | |
Main \ | |
2>&1|grep real | sed 's/ \{1,\}/ /g' | cut -d ' ' -f 2 | |
done; | |
echo | |
echo multiple bindings with system property | |
for i in {1..20}; do | |
/usr/bin/time java -Xmx128m -Xms128m \ | |
-Dslf4j.binding=org.slf4j.helpers.NOPServiceProvider \ | |
-classpath /Users/kengo/GitHub/slf4j/slf4j-api/target/slf4j-api-2.0.0-alpha2-SNAPSHOT.jar:/Users/kengo/GitHub/slf4j/slf4j-nop/target/slf4j-nop-2.0.0-alpha2-SNAPSHOT.jar:/Users/kengo/GitHub/slf4j/slf4j-jdk14/target/slf4j-jdk14-2.0.0-alpha2-SNAPSHOT.jar:/Users/kengo/GitHub/slf4j/slf4j-simple/target/slf4j-simple-2.0.0-alpha2-SNAPSHOT.jar:/Users/kengo/GitHub/spotbugs/spotbugs/build/libs/spotbugs.jar:. \ | |
Main \ | |
2>&1| grep real | sed 's/ \{1,\}/ /g' | cut -d ' ' -f 2 | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment