rm top level fns

This commit is contained in:
2026-01-15 17:56:33 -06:00
parent 5018901acb
commit ac91495679
30 changed files with 340 additions and 451 deletions

View File

@@ -1,5 +1,5 @@
function mainThread() {
var maxDepth = number.max(6, Number(arg[0] || 16));
var maxDepth = max(6, Number(arg[0] || 16));
var stretchDepth = maxDepth + 1;
var check = itemCheck(bottomUpTree(stretchDepth));

View File

@@ -3,7 +3,7 @@ var math = use('math/radians')
function eratosthenes (n) {
var sieve = blob(n, true)
var sqrtN = number.whole(math.sqrt(n));
var sqrtN = whole(math.sqrt(n));
for (i = 2; i <= sqrtN; i++)
if (sieve.read_logical(i))

View File

@@ -204,7 +204,7 @@ function benchStringOps() {
var joinTime = measureTime(function() {
for (var i = 0; i < iterations.complex; i++) {
var result = strings.join(",");
var result = text(strings, ",");
}
});
@@ -239,7 +239,7 @@ function benchArithmetic() {
var result = 1.5;
for (var i = 0; i < iterations.simple; i++) {
result = math.sine(result) + math.cosine(i * 0.01);
result = math.sqrt(number.abs(result)) + 0.1;
result = math.sqrt(abs(result)) + 0.1;
}
});

View File

@@ -44,8 +44,8 @@ for (var i = 0; i < 100; i++) {
// Calculate statistics
function getStats(arr) {
def avg = arr.reduce((a, b) => a + b) / arr.length;
def min = number.min(...arr);
def max = number.max(...arr);
def min = min(...arr);
def max = max(...arr);
return { avg, min, max };
}

View File

@@ -63,7 +63,7 @@ def benchmarks = [
{
name: "Large Array (1k numbers)",
// A thousand random numbers
data: [ Array.from({length:1000}, (_, i) => i * 0.5) ],
data: [ array(1000, i => i *0.5) ],
iterations: 1000
},
{

View File

@@ -98,7 +98,7 @@ def benchmarks = [
},
{
name: "large_array",
data: [ Array.from({length:1000}, (_, i) => i) ],
data: [ array(1000, i => i) ],
iterations: 1000
},
];
@@ -171,13 +171,13 @@ var bench = benchmarks.find(b => b.name == scenario_name);
if (!lib) {
log.console('Unknown library:', lib_name);
log.console('Available libraries:', libraries.map(l => l.name).join(', '));
log.console('Available libraries:', text(libraries.map(l => l.name), ', '));
$stop()
}
if (!bench) {
log.console('Unknown scenario:', scenario_name);
log.console('Available scenarios:', benchmarks.map(b => b.name).join(', '));
log.console('Available scenarios:', text(benchmarks.map(b => b.name), ', '));
$stop()
}