-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_benchmarks.sh
More file actions
executable file
·71 lines (57 loc) · 2.23 KB
/
run_benchmarks.sh
File metadata and controls
executable file
·71 lines (57 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# Script para ejecutar benchmarks con 3 versiones de Python
cd /home/jose/Escritorio/practica-programacion/python/rendimiento-python314
# Crear nombre de archivo con fecha y hora
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
RESULTS_FILE="resultados_${TIMESTAMP}.txt"
# Funcion para ejecutar un test
run_test() {
local version=$1
local label=$2
local script=$3
echo ""
echo "----------------------------------------"
echo "Test: $label"
echo "----------------------------------------"
uv run --python "$version" "$script"
sleep 1
}
# Funcion principal que ejecuta todo
main() {
echo ""
echo "========================================================"
echo " Benchmark: Python 3.12 vs 3.14 (GIL vs sin GIL)"
echo "========================================================"
echo " Guardando resultados en: $RESULTS_FILE"
echo "========================================================"
echo ""
# Test 1: Suma de cuadrados
echo ""
echo "######## TEST 1: SUMA DE CUADRADOS ########"
run_test "3.12.3" "Python 3.12.3 (con GIL)" "test_suma_cuadrados.py"
run_test "3.14" "Python 3.14.0 (con GIL)" "test_suma_cuadrados.py"
run_test "3.14t" "Python 3.14.0t (sin GIL)" "test_suma_cuadrados.py"
# Test 2: Numeros primos
echo ""
echo ""
echo "######## TEST 2: BUSQUEDA DE NUMEROS PRIMOS ########"
run_test "3.12.3" "Python 3.12.3 (con GIL)" "test_primos.py"
run_test "3.14" "Python 3.14.0 (con GIL)" "test_primos.py"
run_test "3.14t" "Python 3.14.0t (sin GIL)" "test_primos.py"
# Test 3: Fibonacci
echo ""
echo ""
echo "######## TEST 3: FIBONACCI ########"
run_test "3.12.3" "Python 3.12.3 (con GIL)" "test_fibonacci.py"
run_test "3.14" "Python 3.14.0 (con GIL)" "test_fibonacci.py"
run_test "3.14t" "Python 3.14.0t (sin GIL)" "test_fibonacci.py"
echo ""
echo "========================================================"
echo " Benchmarks completados"
echo "========================================================"
echo " Resultados guardados en: $RESULTS_FILE"
echo "========================================================"
echo ""
}
# Ejecutar main y guardar resultados con tee
main | tee "$RESULTS_FILE"