BAEL-4644: Small test to check Java JIT compiler performances vs C++ … (#10412)
* BAEL-4644: Small test to check Java JIT compiler performances vs C++ and JS * BAEL-4644: Remove CSV with performance test results * Revert "BAEL-4644: Remove CSV with performance test results" This reverts commit a69c9667
This commit is contained in:
parent
26c646f6fc
commit
d90c7fed48
|
@ -0,0 +1,19 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int fibonacci(int n) {
|
||||||
|
if (n <= 1)
|
||||||
|
return n;
|
||||||
|
return fibonacci(n - 1) + fibonacci(n - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
for (int i = 0; i < 100; i++) {
|
||||||
|
auto startTime = chrono::high_resolution_clock::now().time_since_epoch();
|
||||||
|
int result = fibonacci(12);
|
||||||
|
auto totalTime = chrono::high_resolution_clock::now().time_since_epoch() - startTime;
|
||||||
|
cout << totalTime << "\n";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
function fibonacci(index) {
|
||||||
|
if (index <= 1)
|
||||||
|
return index;
|
||||||
|
return fibonacci(index-1) + fibonacci(index-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i=0; i<100; i++) {
|
||||||
|
var startTime = process.hrtime.bigint();
|
||||||
|
var result = fibonacci(12);
|
||||||
|
var totalTime = process.hrtime.bigint() - startTime;
|
||||||
|
console.log(totalTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.baeldung.performancetests.jit;
|
||||||
|
|
||||||
|
public class Fibonacci {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
for (int i=0; i<100; i++) {
|
||||||
|
long startTime = System.nanoTime();
|
||||||
|
int result = fibonacci(12);
|
||||||
|
long totalTime = System.nanoTime() - startTime;
|
||||||
|
System.out.println(totalTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int fibonacci(int index) {
|
||||||
|
if (index <= 1)
|
||||||
|
return index;
|
||||||
|
return fibonacci(index-1) + fibonacci(index-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
Runs;Java using JIT;Java without JIT;C++ without O2;C++ with O2;JavaScript
|
||||||
|
1;21900;10572;8684;2643;35115
|
||||||
|
2;60790;10572;8306;2643;20389
|
||||||
|
3;1888;24543;7551;2265;20390
|
||||||
|
4;4153;25675;8307;2265;19256
|
||||||
|
5;1888;26053;8307;2265;19257
|
||||||
|
6;5664;25675;8307;1887;35115
|
||||||
|
7;1510;25676;29829;2266;20012
|
||||||
|
8;1510;26053;7929;2643;35493
|
||||||
|
9;1511;23787;7929;1888;40023
|
||||||
|
10;3776;26431;26053;3776;20012
|
||||||
|
11;1510;25676;7929;2265;35115
|
||||||
|
12;1510;10195;7552;3775;19256
|
||||||
|
13;17746;10572;7552;1888;40024
|
||||||
|
14;26431;10194;7552;2265;19257
|
||||||
|
15;1133;10195;8685;2265;18501
|
||||||
|
16;1133;10572;7929;2265;18879
|
||||||
|
17;1133;10572;7929;1888;53995
|
||||||
|
18;756;10195;7929;1888;35115
|
||||||
|
19;1133;10195;7930;2266;19634
|
||||||
|
20;756;10573;7552;2266;37003
|
||||||
|
21;1133;9817;7552;1888;35115
|
||||||
|
22;1133;10194;7930;2266;32472
|
||||||
|
23;1133;10195;7929;2266;18879
|
||||||
|
24;755;10195;8307;3776;19257
|
||||||
|
25;755;10195;7551;1888;34738
|
||||||
|
26;1510;10194;7551;2265;18501
|
||||||
|
27;3776;10194;7929;2266;33227
|
||||||
|
28;1888;37758;9440;1888;19634
|
||||||
|
29;1133;10573;8306;1888;32472
|
||||||
|
30;1133;26430;7929;2265;32849
|
||||||
|
31;1133;24165;8306;4153;32850
|
||||||
|
32;755;24166;7929;2643;18879
|
||||||
|
33;1133;10572;24920;4153;32850
|
||||||
|
34;755;23788;10194;2643;19257
|
||||||
|
35;756;23788;12837;4154;18501
|
||||||
|
36;755;11328;8307;2643;33227
|
||||||
|
37;1132;29829;8307;7174;1000211
|
||||||
|
38;755;36625;8307;4531;39646
|
||||||
|
39;1133;10950;7929;2643;34360
|
||||||
|
40;1133;10950;7929;4531;3021
|
||||||
|
41;1133;10573;7929;2643;2643
|
||||||
|
42;755;29829;15104;2643;2643
|
||||||
|
43;755;29829;13971;2643;3398
|
||||||
|
44;1133;10950;8685;5664;3021
|
||||||
|
45;1133;10950;9817;3020;3398
|
||||||
|
46;1133;10950;8684;3776;3020
|
||||||
|
47;1888;30962;7930;3020;3021
|
||||||
|
48;1132;10950;8307;2643;3399
|
||||||
|
49;1133;29451;7929;2265;2266
|
||||||
|
50;1133;29452;8307;23033;2265
|
||||||
|
51;755;10950;7929;2643;2266
|
||||||
|
52;755;10950;7930;2643;2643
|
||||||
|
53;755;11327;7929;4908;2265
|
||||||
|
54;755;11328;7929;2265;2643
|
||||||
|
55;1133;10572;7929;18879;16236
|
||||||
|
56;756;36248;7929;2643;2643
|
||||||
|
57;755;10572;7929;2265;2643
|
||||||
|
58;755;10950;9818;2644;2643
|
||||||
|
59;1132;10950;7929;2266;2643
|
||||||
|
60;20012;30206;7929;2266;3021
|
||||||
|
61;1133;30206;7929;2266;16613
|
||||||
|
62;1511;30206;7552;2266;2643
|
||||||
|
63;3021;30207;8307;1888;2643
|
||||||
|
64;1510;10950;7929;1888;2266
|
||||||
|
65;1510;30207;7929;2266;2644
|
||||||
|
66;1888;30207;8307;2265;2643
|
||||||
|
67;1511;29829;7929;2266;2643
|
||||||
|
68;1888;10950;7930;2265;2266
|
||||||
|
69;1510;29829;7929;21145;3020
|
||||||
|
70;1511;29829;7929;1888;16613
|
||||||
|
71;1510;30206;7929;2643;2265
|
||||||
|
72;1510;10950;7929;2266;2644
|
||||||
|
73;1888;10573;24921;18124;2266
|
||||||
|
74;1888;10573;9062;6797;2644
|
||||||
|
75;1888;10950;7929;2265;2643
|
||||||
|
76;1133;10950;7929;2266;2644
|
||||||
|
77;1133;29829;12460;2266;3020
|
||||||
|
78;755;11328;8307;2643;2266
|
||||||
|
79;755;11327;8684;2266;2643
|
||||||
|
80;1133;30206;8307;2266;2643
|
||||||
|
81;1133;29829;7929;2266;2266
|
||||||
|
82;1888;30206;7929;2266;16236
|
||||||
|
83;1510;11327;8307;2266;16613
|
||||||
|
84;1888;11327;7929;2265;2643
|
||||||
|
85;1133;10573;8307;6042;2266
|
||||||
|
86;1133;10950;7929;2643;2266
|
||||||
|
87;1133;10950;9817;2265;2265
|
||||||
|
88;755;10950;24165;2643;2643
|
||||||
|
89;755;11328;7929;3399;2643
|
||||||
|
90;755;10950;8307;4909;3020
|
||||||
|
91;755;10572;7552;23787;3020
|
||||||
|
92;1133;10572;7929;2643;3021
|
||||||
|
93;1132;10572;8307;2643;2643
|
||||||
|
94;1132;10950;7551;2266;3398
|
||||||
|
95;755;10950;23788;2265;2644
|
||||||
|
96;755;10573;7551;1888;2265
|
||||||
|
97;755;29829;12460;2266;2643
|
||||||
|
98;1132;30207;7929;2266;2265
|
||||||
|
99;1133;30206;7929;2265;2266
|
||||||
|
100;755;10572;7929;2265;2643
|
||||||
|
;;;;;
|
||||||
|
;;;;;
|
|
Loading…
Reference in New Issue