Artifact 3a339946003dc76539019159544635e533c5805bd32460a8cc3a3fdbb7dc5389:
- File typeparse/exemples/crible/comparer.sh — part of check-in [c8a247a331] at 2026-11-26 10:32:15 on branch tip-764_tcl90 — - A strided slice of a compact list filled with a single value is validated and encoded once, then copied cell to cell (TclCompactFillFrom). Sieve, 10^6 bytes: 99 -> 2.2 ms; 9 ms total. - exemples/crible: comparison with C, JavaScript, Python, PHP, Ruby, Perl - type repeat T N ?value?: a list of T made of N times the value (zero by default), in cells without an intermediate list (one million bytes: 0.1 ms); test t131 - direct sum of s + $v over integer cells (8, 16, 32 bits) when no partial sum can exceed 64 bits; test t132 (sieve, 10^6 bytes: counting 2.8 -> 0.2 ms, 2.5 ms total) (user: Florentis, size: 713) [annotate] [blame] [check-ins using]
#!/bin/sh # comparer.sh -- le crible dans Tcl et dans les langages présents. # sh comparer.sh /chemin/vers/tclsh # Colonnes : créer, cribler, compter, total (ms, meilleur de 5), N = 10^6. TCLSH=${1:-tclsh9.0} ICI=$(cd "$(dirname "$0")" && pwd) A=$ICI/autres "$TCLSH" "$ICI/crible.tcl" echo "-- autres langages" if command -v gcc >/dev/null; then T=$(mktemp -d); gcc -O2 -o "$T/crible" "$A/crible.c" && "$T/crible"; rm -rf "$T" fi command -v node >/dev/null && node "$A/crible.js" command -v python3 >/dev/null && python3 "$A/crible.py" command -v php >/dev/null && php "$A/crible.php" command -v ruby >/dev/null && ruby "$A/crible.rb" command -v perl >/dev/null && perl "$A/crible.pl" exit 0