chore: upgrade project dependencies to latest compatible versions across all modules

This commit is contained in:
2025-12-03 22:51:38 +00:00
parent f83de7abcd
commit e768ed066c
6 changed files with 502 additions and 5 deletions
+253 -1
View File
@@ -45,8 +45,150 @@ public class Benchmark {
return sum;
}
public static int arraySum(int size) {
int[] arr = new int[size];
for (int i = 0; i < size; i++) {
arr[i] = i;
}
int sum = 0;
for (int ii = 0; ii < size; ii++) {
sum = sum + arr[ii];
}
return sum;
}
public static int arrayReverse(int size) {
int[] arr = new int[size];
for (int i = 0; i < size; i++) {
arr[i] = i;
}
for (int ii = 0; ii < size / 2; ii++) {
int temp = arr[ii];
arr[ii] = arr[size - 1 - ii];
arr[size - 1 - ii] = temp;
}
return arr[0];
}
public static int nestedLoops(int n) {
int sum = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
sum = sum + i + j;
}
}
return sum;
}
public static int factorial(int n) {
if (n <= 1) {
return 1;
}
return n * factorial(n - 1);
}
public static int ackermann(int m, int n) {
if (m == 0) {
return n + 1;
}
if (n == 0) {
return ackermann(m - 1, 1);
}
return ackermann(m - 1, ackermann(m, n - 1));
}
public static int identity(int x) {
return x;
}
public static int methodCallOverhead(int iterations) {
int sum = 0;
for (int i = 0; i < iterations; i++) {
sum = sum + identity(i);
}
return sum;
}
public static long arithmeticOps(int iterations) {
long result = 0L;
for (int i = 1; i < iterations; i++) {
result = result + i * 2 - i / 2 + i % 7;
}
return result;
}
public static int conditionalBranching(int iterations) {
int sum = 0;
for (int i = 0; i < iterations; i++) {
if (i % 2 == 0) {
sum = sum + i;
} else {
sum = sum - i;
}
}
return sum;
}
public static int complexConditions(int iterations) {
int count = 0;
for (int i = 0; i < iterations; i++) {
if (i % 3 == 0 && i % 5 == 0) {
count = count + 1;
} else if (i % 3 == 0) {
count = count + 2;
} else if (i % 5 == 0) {
count = count + 3;
}
}
return count;
}
public static int matrixMultiply(int size) {
int[][] a = new int[size][size];
int[][] b = new int[size][size];
int[][] c = new int[size][size];
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
a[i][j] = i + j;
b[i][j] = i - j;
}
}
for (int ii = 0; ii < size; ii++) {
for (int jj = 0; jj < size; jj++) {
int sum = 0;
for (int kk = 0; kk < size; kk++) {
sum = sum + a[ii][kk] * b[kk][jj];
}
c[ii][jj] = sum;
}
}
return c[0][0];
}
public static int bubbleSort(int size) {
int[] arr = new int[size];
for (int i = 0; i < size; i++) {
arr[i] = size - i;
}
for (int ii = 0; ii < size - 1; ii++) {
for (int jj = 0; jj < size - ii - 1; jj++) {
if (arr[jj] > arr[jj + 1]) {
int temp = arr[jj];
arr[jj] = arr[jj + 1];
arr[jj + 1] = temp;
}
}
}
return arr[0];
}
public static int main() {
System.out.println("=== Rava Benchmark Suite ===");
System.out.println("=== Rava Comprehensive Benchmark Suite ===");
long start = System.nanoTime();
int fib30 = fibonacci(30);
@@ -88,6 +230,116 @@ public class Benchmark {
System.out.print(sumTime);
System.out.println(" ms");
start = System.nanoTime();
int arrSum = arraySum(1000000);
end = System.nanoTime();
long arrSumTime = (end - start) / 1000000;
System.out.print("Array sum (1M elements) = ");
System.out.println(arrSum);
System.out.print("Time: ");
System.out.print(arrSumTime);
System.out.println(" ms");
start = System.nanoTime();
int arrRev = arrayReverse(1000000);
end = System.nanoTime();
long arrRevTime = (end - start) / 1000000;
System.out.print("Array reverse (1M elements) = ");
System.out.println(arrRev);
System.out.print("Time: ");
System.out.print(arrRevTime);
System.out.println(" ms");
start = System.nanoTime();
int nested = nestedLoops(1000);
end = System.nanoTime();
long nestedTime = (end - start) / 1000000;
System.out.print("Nested loops (1000x1000) = ");
System.out.println(nested);
System.out.print("Time: ");
System.out.print(nestedTime);
System.out.println(" ms");
start = System.nanoTime();
int fact = factorial(15);
end = System.nanoTime();
long factTime = (end - start) / 1000000;
System.out.print("Factorial(15) recursive = ");
System.out.println(fact);
System.out.print("Time: ");
System.out.print(factTime);
System.out.println(" ms");
start = System.nanoTime();
int ack = ackermann(3, 6);
end = System.nanoTime();
long ackTime = (end - start) / 1000000;
System.out.print("Ackermann(3, 6) = ");
System.out.println(ack);
System.out.print("Time: ");
System.out.print(ackTime);
System.out.println(" ms");
start = System.nanoTime();
int methodCall = methodCallOverhead(10000000);
end = System.nanoTime();
long methodCallTime = (end - start) / 1000000;
System.out.print("Method calls (10M) = ");
System.out.println(methodCall);
System.out.print("Time: ");
System.out.print(methodCallTime);
System.out.println(" ms");
start = System.nanoTime();
long arith = arithmeticOps(10000000);
end = System.nanoTime();
long arithTime = (end - start) / 1000000;
System.out.print("Arithmetic ops (10M) = ");
System.out.println(arith);
System.out.print("Time: ");
System.out.print(arithTime);
System.out.println(" ms");
start = System.nanoTime();
int cond = conditionalBranching(10000000);
end = System.nanoTime();
long condTime = (end - start) / 1000000;
System.out.print("Conditional branches (10M) = ");
System.out.println(cond);
System.out.print("Time: ");
System.out.print(condTime);
System.out.println(" ms");
start = System.nanoTime();
int complex = complexConditions(10000000);
end = System.nanoTime();
long complexTime = (end - start) / 1000000;
System.out.print("Complex conditions (10M) = ");
System.out.println(complex);
System.out.print("Time: ");
System.out.print(complexTime);
System.out.println(" ms");
start = System.nanoTime();
int matrix = matrixMultiply(50);
end = System.nanoTime();
long matrixTime = (end - start) / 1000000;
System.out.print("Matrix multiply (50x50) = ");
System.out.println(matrix);
System.out.print("Time: ");
System.out.print(matrixTime);
System.out.println(" ms");
start = System.nanoTime();
int bubble = bubbleSort(5000);
end = System.nanoTime();
long bubbleTime = (end - start) / 1000000;
System.out.print("Bubble sort (5000 elements) = ");
System.out.println(bubble);
System.out.print("Time: ");
System.out.print(bubbleTime);
System.out.println(" ms");
System.out.println("=== Benchmark Complete ===");
return 0;
}
+180 -1
View File
@@ -34,8 +34,110 @@ def sum_loop(iterations):
total += i
return total
def array_sum(size):
arr = [0] * size
for i in range(size):
arr[i] = i
total = 0
for i in range(size):
total += arr[i]
return total
def array_reverse(size):
arr = [0] * size
for i in range(size):
arr[i] = i
for i in range(size // 2):
arr[i], arr[size - 1 - i] = arr[size - 1 - i], arr[i]
return arr[0]
def nested_loops(n):
total = 0
for i in range(n):
for j in range(n):
total += i + j
return total
def factorial(n):
if n <= 1:
return 1
return n * factorial(n - 1)
def ackermann(m, n):
if m == 0:
return n + 1
if n == 0:
return ackermann(m - 1, 1)
return ackermann(m - 1, ackermann(m, n - 1))
def method_call_overhead(iterations):
total = 0
for i in range(iterations):
total += identity(i)
return total
def identity(x):
return x
def arithmetic_ops(iterations):
result = 0
for i in range(1, iterations):
result += i * 2 - i // 2 + i % 7
return result
def conditional_branching(iterations):
total = 0
for i in range(iterations):
if i % 2 == 0:
total += i
else:
total -= i
return total
def complex_conditions(iterations):
count = 0
for i in range(iterations):
if i % 3 == 0 and i % 5 == 0:
count += 1
elif i % 3 == 0:
count += 2
elif i % 5 == 0:
count += 3
return count
def matrix_multiply(size):
a = [[0] * size for _ in range(size)]
b = [[0] * size for _ in range(size)]
c = [[0] * size for _ in range(size)]
for i in range(size):
for j in range(size):
a[i][j] = i + j
b[i][j] = i - j
for i in range(size):
for j in range(size):
total = 0
for k in range(size):
total += a[i][k] * b[k][j]
c[i][j] = total
return c[0][0]
def bubble_sort(size):
arr = [0] * size
for i in range(size):
arr[i] = size - i
for i in range(size - 1):
for j in range(size - i - 1):
if arr[j] > arr[j + 1]:
arr[j], arr[j + 1] = arr[j + 1], arr[j]
return arr[0]
def main():
print("=== Python Benchmark Suite ===")
print("=== Python Comprehensive Benchmark Suite ===")
start = time.perf_counter_ns()
fib30 = fibonacci(30)
@@ -65,6 +167,83 @@ def main():
print(f"Sum 0..10000000 = {sum_result}")
print(f"Time: {sum_time} ms")
start = time.perf_counter_ns()
arr_sum = array_sum(1000000)
end = time.perf_counter_ns()
arr_sum_time = (end - start) // 1000000
print(f"Array sum (1M elements) = {arr_sum}")
print(f"Time: {arr_sum_time} ms")
start = time.perf_counter_ns()
arr_rev = array_reverse(1000000)
end = time.perf_counter_ns()
arr_rev_time = (end - start) // 1000000
print(f"Array reverse (1M elements) = {arr_rev}")
print(f"Time: {arr_rev_time} ms")
start = time.perf_counter_ns()
nested = nested_loops(1000)
end = time.perf_counter_ns()
nested_time = (end - start) // 1000000
print(f"Nested loops (1000x1000) = {nested}")
print(f"Time: {nested_time} ms")
start = time.perf_counter_ns()
fact = factorial(15)
end = time.perf_counter_ns()
fact_time = (end - start) // 1000000
print(f"Factorial(15) recursive = {fact}")
print(f"Time: {fact_time} ms")
start = time.perf_counter_ns()
ack = ackermann(3, 6)
end = time.perf_counter_ns()
ack_time = (end - start) // 1000000
print(f"Ackermann(3, 6) = {ack}")
print(f"Time: {ack_time} ms")
start = time.perf_counter_ns()
method_call = method_call_overhead(10000000)
end = time.perf_counter_ns()
method_call_time = (end - start) // 1000000
print(f"Method calls (10M) = {method_call}")
print(f"Time: {method_call_time} ms")
start = time.perf_counter_ns()
arith = arithmetic_ops(10000000)
end = time.perf_counter_ns()
arith_time = (end - start) // 1000000
print(f"Arithmetic ops (10M) = {arith}")
print(f"Time: {arith_time} ms")
start = time.perf_counter_ns()
cond = conditional_branching(10000000)
end = time.perf_counter_ns()
cond_time = (end - start) // 1000000
print(f"Conditional branches (10M) = {cond}")
print(f"Time: {cond_time} ms")
start = time.perf_counter_ns()
complex = complex_conditions(10000000)
end = time.perf_counter_ns()
complex_time = (end - start) // 1000000
print(f"Complex conditions (10M) = {complex}")
print(f"Time: {complex_time} ms")
start = time.perf_counter_ns()
matrix = matrix_multiply(50)
end = time.perf_counter_ns()
matrix_time = (end - start) // 1000000
print(f"Matrix multiply (50x50) = {matrix}")
print(f"Time: {matrix_time} ms")
start = time.perf_counter_ns()
bubble = bubble_sort(5000)
end = time.perf_counter_ns()
bubble_time = (end - start) // 1000000
print(f"Bubble sort (5000 elements) = {bubble}")
print(f"Time: {bubble_time} ms")
print("=== Benchmark Complete ===")
if __name__ == "__main__":