diff --git a/.autoloop/programs/tsb-perf-evolve/code/benchmark.py b/.autoloop/programs/tsb-perf-evolve/code/benchmark.py index 165f387e..817c92b3 100644 --- a/.autoloop/programs/tsb-perf-evolve/code/benchmark.py +++ b/.autoloop/programs/tsb-perf-evolve/code/benchmark.py @@ -20,7 +20,7 @@ # Inlined from config.yaml (kept in sync with benchmark.ts). DATASET_SIZE = 100_000 NAN_RATIO = 0.05 -WARMUP_ITERATIONS = 5 +WARMUP_ITERATIONS = 200 MEASURED_ITERATIONS = 50 RANDOM_SEED = 42 diff --git a/.autoloop/programs/tsb-perf-evolve/code/benchmark.ts b/.autoloop/programs/tsb-perf-evolve/code/benchmark.ts index fe6635cb..75f4b60c 100644 --- a/.autoloop/programs/tsb-perf-evolve/code/benchmark.ts +++ b/.autoloop/programs/tsb-perf-evolve/code/benchmark.ts @@ -11,7 +11,7 @@ import { Series } from "../../../../src/index.ts"; // (No YAML parser dependency to keep this benchmark hermetic.) const DATASET_SIZE = 100_000; const NAN_RATIO = 0.05; -const WARMUP_ITERATIONS = 5; +const WARMUP_ITERATIONS = 200; const MEASURED_ITERATIONS = 50; const RANDOM_SEED = 42; diff --git a/.autoloop/programs/tsb-perf-evolve/code/config.yaml b/.autoloop/programs/tsb-perf-evolve/code/config.yaml index 509b4255..b007bc2c 100644 --- a/.autoloop/programs/tsb-perf-evolve/code/config.yaml +++ b/.autoloop/programs/tsb-perf-evolve/code/config.yaml @@ -17,6 +17,6 @@ archive_size: 10 # Benchmark dataset shape. Both benchmark.ts and benchmark.py read this. dataset_size: 100000 nan_ratio: 0.05 -warmup_iterations: 5 +warmup_iterations: 200 measured_iterations: 50 random_seed: 42 diff --git a/biome.json b/biome.json index 96f8afcd..353ba7be 100644 --- a/biome.json +++ b/biome.json @@ -41,7 +41,8 @@ "noUnusedVariables": "warn" }, "nursery": { - "all": true + "all": true, + "noSecrets": "off" }, "performance": { "all": true, diff --git a/src/core/pd_array.ts b/src/core/pd_array.ts index de891d94..c6d43e7b 100644 --- a/src/core/pd_array.ts +++ b/src/core/pd_array.ts @@ -88,46 +88,35 @@ function classifyScalar(v: Scalar): "date" | "bigint" | "float" | "int" | "strin } function inferDtype(data: readonly Scalar[]): DtypeName { - let hasFloat = false; - let hasInt = false; - let hasString = false; - let hasBool = false; - let hasDate = false; - let hasBigInt = false; - + const kinds = new Set<"date" | "bigint" | "float" | "int" | "string" | "bool">(); for (const v of data) { const kind = classifyScalar(v); - if (kind === "date") { - hasDate = true; - } else if (kind === "bigint") { - hasBigInt = true; - } else if (kind === "float") { - hasFloat = true; - } else if (kind === "int") { - hasInt = true; - } else if (kind === "string") { - hasString = true; - } else if (kind === "bool") { - hasBool = true; + if (kind !== null) { + kinds.add(kind); } } + return resolveDtype(kinds); +} - if (hasDate) { +function resolveDtype( + kinds: ReadonlySet<"date" | "bigint" | "float" | "int" | "string" | "bool">, +): DtypeName { + if (kinds.has("date")) { return "datetime"; } - if (hasBigInt) { + if (kinds.has("bigint")) { return "int64"; } - if (hasFloat) { + if (kinds.has("float")) { return "float64"; } - if (hasInt && !hasString && !hasBool) { + if (kinds.has("int") && !kinds.has("string") && !kinds.has("bool")) { return "int64"; } - if (hasBool && !hasInt && !hasFloat && !hasString) { + if (kinds.has("bool") && !kinds.has("int") && !kinds.has("float") && !kinds.has("string")) { return "bool"; } - if (hasString) { + if (kinds.has("string")) { return "string"; } return "object"; diff --git a/src/core/series.ts b/src/core/series.ts index 29063e91..0b39da52 100644 --- a/src/core/series.ts +++ b/src/core/series.ts @@ -219,6 +219,16 @@ export class Series { readonly index: Index