Skip to content

Instantly share code, notes, and snippets.

@harbulot
Last active October 24, 2023 11:21
Show Gist options
  • Save harbulot/f6a3b2f8d082386729f06a22d8afd743 to your computer and use it in GitHub Desktop.
Save harbulot/f6a3b2f8d082386729f06a22d8afd743 to your computer and use it in GitHub Desktop.
Compiled with Amazon Corretto (javac 17.0.7)
https://gist.github.com/amaembo/fd82f368be71f44480c522f8766bfd89
public class Benchmark
minor version: 0
major version: 61
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Methodref #2.#3 // java/lang/Object."<init>":()V
#2 = Class #4 // java/lang/Object
#3 = NameAndType #5:#6 // "<init>":()V
#4 = Utf8 java/lang/Object
#5 = Utf8 <init>
#6 = Utf8 ()V
#7 = InvokeDynamic #0:#8 // #0:getAsInt:()Ljava/util/function/IntSupplier;
#8 = NameAndType #9:#10 // getAsInt:()Ljava/util/function/IntSupplier;
#9 = Utf8 getAsInt
#10 = Utf8 ()Ljava/util/function/IntSupplier;
#11 = InterfaceMethodref #12.#13 // java/util/function/IntSupplier.getAsInt:()I
#12 = Class #14 // java/util/function/IntSupplier
#13 = NameAndType #9:#15 // getAsInt:()I
#14 = Utf8 java/util/function/IntSupplier
#15 = Utf8 ()I
#16 = Methodref #17.#18 // Benchmark.compute:()I
#17 = Class #19 // Benchmark
#18 = NameAndType #20:#15 // compute:()I
#19 = Utf8 Benchmark
#20 = Utf8 compute
#21 = Methodref #22.#23 // java/lang/System.currentTimeMillis:()J
#22 = Class #24 // java/lang/System
#23 = NameAndType #25:#26 // currentTimeMillis:()J
#24 = Utf8 java/lang/System
#25 = Utf8 currentTimeMillis
#26 = Utf8 ()J
#27 = Fieldref #22.#28 // java/lang/System.out:Ljava/io/PrintStream;
#28 = NameAndType #29:#30 // out:Ljava/io/PrintStream;
#29 = Utf8 out
#30 = Utf8 Ljava/io/PrintStream;
#31 = Methodref #32.#33 // java/io/PrintStream.println:(I)V
#32 = Class #34 // java/io/PrintStream
#33 = NameAndType #35:#36 // println:(I)V
#34 = Utf8 java/io/PrintStream
#35 = Utf8 println
#36 = Utf8 (I)V
#37 = InvokeDynamic #1:#38 // #1:makeConcatWithConstants:(J)Ljava/lang/String;
#38 = NameAndType #39:#40 // makeConcatWithConstants:(J)Ljava/lang/String;
#39 = Utf8 makeConcatWithConstants
#40 = Utf8 (J)Ljava/lang/String;
#41 = Methodref #32.#42 // java/io/PrintStream.println:(Ljava/lang/String;)V
#42 = NameAndType #35:#43 // println:(Ljava/lang/String;)V
#43 = Utf8 (Ljava/lang/String;)V
#44 = Methodref #17.#3 // Benchmark."<init>":()V
#45 = Methodref #17.#46 // Benchmark.measure:()V
#46 = NameAndType #47:#6 // measure:()V
#47 = Utf8 measure
#48 = InterfaceMethodref #49.#50 // java/util/stream/IntStream.range:(II)Ljava/util/stream/IntStream;
#49 = Class #51 // java/util/stream/IntStream
#50 = NameAndType #52:#53 // range:(II)Ljava/util/stream/IntStream;
#51 = Utf8 java/util/stream/IntStream
#52 = Utf8 range
#53 = Utf8 (II)Ljava/util/stream/IntStream;
#54 = InvokeDynamic #2:#55 // #2:applyAsInt:()Ljava/util/function/IntUnaryOperator;
#55 = NameAndType #56:#57 // applyAsInt:()Ljava/util/function/IntUnaryOperator;
#56 = Utf8 applyAsInt
#57 = Utf8 ()Ljava/util/function/IntUnaryOperator;
#58 = InterfaceMethodref #49.#59 // java/util/stream/IntStream.map:(Ljava/util/function/IntUnaryOperator;)Ljava/util/stream/IntStream;
#59 = NameAndType #60:#61 // map:(Ljava/util/function/IntUnaryOperator;)Ljava/util/stream/IntStream;
#60 = Utf8 map
#61 = Utf8 (Ljava/util/function/IntUnaryOperator;)Ljava/util/stream/IntStream;
#62 = InterfaceMethodref #49.#63 // java/util/stream/IntStream.sum:()I
#63 = NameAndType #64:#15 // sum:()I
#64 = Utf8 sum
#65 = Utf8 Code
#66 = Utf8 LineNumberTable
#67 = Utf8 StackMapTable
#68 = Utf8 main
#69 = Utf8 ([Ljava/lang/String;)V
#70 = Utf8 lambda$compute$1
#71 = Utf8 lambda$compute$0
#72 = Utf8 (I)I
#73 = Utf8 SourceFile
#74 = Utf8 Benchmark.java
#75 = Utf8 BootstrapMethods
#76 = MethodHandle #6:#77 // invokestatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
#77 = Methodref #78.#79 // java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
#78 = Class #80 // java/lang/invoke/LambdaMetafactory
#79 = NameAndType #81:#82 // metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
#80 = Utf8 java/lang/invoke/LambdaMetafactory
#81 = Utf8 metafactory
#82 = Utf8 (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
#83 = MethodType #15 // ()I
#84 = MethodHandle #6:#85 // invokestatic Benchmark.lambda$compute$1:()I
#85 = Methodref #17.#86 // Benchmark.lambda$compute$1:()I
#86 = NameAndType #70:#15 // lambda$compute$1:()I
#87 = MethodHandle #6:#88 // invokestatic java/lang/invoke/StringConcatFactory.makeConcatWithConstants:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
#88 = Methodref #89.#90 // java/lang/invoke/StringConcatFactory.makeConcatWithConstants:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
#89 = Class #91 // java/lang/invoke/StringConcatFactory
#90 = NameAndType #39:#92 // makeConcatWithConstants:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
#91 = Utf8 java/lang/invoke/StringConcatFactory
#92 = Utf8 (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
#93 = String #94 // Duration: ms
#94 = Utf8 Duration: ms
#95 = MethodType #72 // (I)I
#96 = MethodHandle #6:#97 // invokestatic Benchmark.lambda$compute$0:(I)I
#97 = Methodref #17.#98 // Benchmark.lambda$compute$0:(I)I
#98 = NameAndType #71:#72 // lambda$compute$0:(I)I
#99 = Utf8 InnerClasses
#100 = Class #101 // java/lang/invoke/MethodHandles$Lookup
#101 = Utf8 java/lang/invoke/MethodHandles$Lookup
#102 = Class #103 // java/lang/invoke/MethodHandles
#103 = Utf8 java/lang/invoke/MethodHandles
#104 = Utf8 Lookup
{
public Benchmark();
descriptor: ()V
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
LineNumberTable:
line 4: 0
private int compute();
descriptor: ()I
flags: ACC_PRIVATE
Code:
stack=2, locals=4, args_size=1
0: invokedynamic #7, 0 // InvokeDynamic #0:getAsInt:()Ljava/util/function/IntSupplier;
5: astore_1
6: invokedynamic #7, 0 // InvokeDynamic #0:getAsInt:()Ljava/util/function/IntSupplier;
11: astore_2
12: invokedynamic #7, 0 // InvokeDynamic #0:getAsInt:()Ljava/util/function/IntSupplier;
17: astore_3
18: aload_1
19: invokeinterface #11, 1 // InterfaceMethod java/util/function/IntSupplier.getAsInt:()I
24: aload_2
25: invokeinterface #11, 1 // InterfaceMethod java/util/function/IntSupplier.getAsInt:()I
30: iadd
31: aload_3
32: invokeinterface #11, 1 // InterfaceMethod java/util/function/IntSupplier.getAsInt:()I
37: iadd
38: ireturn
LineNumberTable:
line 6: 0
line 7: 6
line 8: 12
line 9: 18
private void measure();
descriptor: ()V
flags: ACC_PRIVATE
Code:
stack=5, locals=6, args_size=1
0: iconst_0
1: istore_1
2: iconst_0
3: istore_2
4: iload_2
5: sipush 20000
8: if_icmpge 24
11: iload_1
12: aload_0
13: invokevirtual #16 // Method compute:()I
16: iadd
17: istore_1
18: iinc 2, 1
21: goto 4
24: invokestatic #21 // Method java/lang/System.currentTimeMillis:()J
27: lstore_2
28: iconst_0
29: istore 4
31: iload 4
33: sipush 20000
36: if_icmpge 52
39: iload_1
40: aload_0
41: invokevirtual #16 // Method compute:()I
44: iadd
45: istore_1
46: iinc 4, 1
49: goto 31
52: invokestatic #21 // Method java/lang/System.currentTimeMillis:()J
55: lstore 4
57: getstatic #27 // Field java/lang/System.out:Ljava/io/PrintStream;
60: iload_1
61: invokevirtual #31 // Method java/io/PrintStream.println:(I)V
64: getstatic #27 // Field java/lang/System.out:Ljava/io/PrintStream;
67: lload 4
69: lload_2
70: lsub
71: invokedynamic #37, 0 // InvokeDynamic #1:makeConcatWithConstants:(J)Ljava/lang/String;
76: invokevirtual #41 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
79: return
LineNumberTable:
line 13: 0
line 15: 2
line 16: 11
line 15: 18
line 20: 24
line 21: 28
line 22: 39
line 21: 46
line 24: 52
line 25: 57
line 26: 64
line 27: 79
StackMapTable: number_of_entries = 4
frame_type = 253 /* append */
offset_delta = 4
locals = [ int, int ]
frame_type = 250 /* chop */
offset_delta = 19
frame_type = 253 /* append */
offset_delta = 6
locals = [ long, int ]
frame_type = 250 /* chop */
offset_delta = 20
public static void main(java.lang.String[]);
descriptor: ([Ljava/lang/String;)V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=2, locals=1, args_size=1
0: new #17 // class Benchmark
3: dup
4: invokespecial #44 // Method "<init>":()V
7: invokevirtual #45 // Method measure:()V
10: return
LineNumberTable:
line 30: 0
line 31: 10
private static int lambda$compute$1();
descriptor: ()I
flags: ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
Code:
stack=2, locals=0, args_size=0
0: iconst_0
1: sipush 10000
4: invokestatic #48 // InterfaceMethod java/util/stream/IntStream.range:(II)Ljava/util/stream/IntStream;
7: invokedynamic #54, 0 // InvokeDynamic #2:applyAsInt:()Ljava/util/function/IntUnaryOperator;
12: invokeinterface #58, 2 // InterfaceMethod java/util/stream/IntStream.map:(Ljava/util/function/IntUnaryOperator;)Ljava/util/stream/IntStream;
17: invokeinterface #62, 1 // InterfaceMethod java/util/stream/IntStream.sum:()I
22: ireturn
LineNumberTable:
line 6: 0
private static int lambda$compute$0(int);
descriptor: (I)I
flags: ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
Code:
stack=1, locals=1, args_size=1
0: iconst_1
1: ireturn
LineNumberTable:
line 6: 0
}
SourceFile: "Benchmark.java"
BootstrapMethods:
0: #76 invokestatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
Method arguments:
#83 ()I
#84 invokestatic Benchmark.lambda$compute$1:()I
#83 ()I
1: #87 invokestatic java/lang/invoke/StringConcatFactory.makeConcatWithConstants:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
Method arguments:
#93 Duration: ms
2: #76 invokestatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
Method arguments:
#95 (I)I
#96 invokestatic Benchmark.lambda$compute$0:(I)I
#95 (I)I
InnerClasses:
public static final #104= #100 of #102; //Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment