from __future__ import annotations
import re
BENCHMARK_FIELDS = [
"schema_version",
"campaign_id",
"run_id",
"sample_index",
"engine",
"operation",
"alphabet",
"padding",
"input_len",
"encoded_len",
"iterations",
"elapsed_ns",
"throughput_mib_s",
"backend",
"active_encode_backend",
"active_decode_backend",
"target_arch",
"target_os",
"allocation_count",
]
AVAILABILITY_FIELDS = [
"schema_version",
"backend",
"available",
"target_arch",
"target_os",
]
RESOURCE_FIELDS = [
"schema_version",
"category",
"name",
"feature_set",
"value",
"unit",
"method",
]
SUMMARY_FIELDS = [
"schema_version",
"engine",
"operation",
"alphabet",
"padding",
"input_len",
"backend",
"target_arch",
"target_os",
"sample_count",
"median_throughput_mib_s",
"minimum_throughput_mib_s",
"maximum_throughput_mib_s",
]
ADMISSION_FIELDS = [
"schema_version",
"backend",
"operation",
"alphabet",
"padding",
"input_len",
"target_arch",
"target_os",
"median_throughput_mib_s",
"scalar_median_throughput_mib_s",
"ratio_to_scalar",
"status",
]
BINARY_RESOURCE_FIELDS = [
"schema_version",
"feature_set",
"binary_bytes",
"base64_ng_symbol_count",
"method",
]
PROFILES = {
("standard", "padded"),
("standard", "unpadded"),
("url-safe", "padded"),
("url-safe", "unpadded"),
}
OPERATIONS = {"encode", "decode"}
ENGINES = {"base64-ng", "base64-0.23.0", "base64ct-1.8.3"}
BACKEND_MINIMUM = {
"auto": {"encode": 1, "decode": 1},
"ssse3-sse4.1": {"encode": 12, "decode": 12},
"avx2": {"encode": 24, "decode": 24},
"avx512-vbmi": {"encode": 48, "decode": 48},
"neon": {"encode": 12, "decode": 12},
"wasm-simd128": {"encode": 12, "decode": 12},
}
BACKENDS = set(BACKEND_MINIMUM) | {"scalar"}
RESOURCE_CATEGORIES = {
"stack-bound",
"adapter-pending-memory",
"adapter-size",
}
RESOURCE_CONTRACT = {
("stack-bound", "in-place-input-staging", "bytes", "source-and-size-of"),
("stack-bound", "in-place-output-staging", "bytes", "source-and-size-of"),
(
"adapter-pending-memory",
"encoder-writer-output-capacity",
"bytes",
"source-and-size-of",
),
("adapter-size", "encoder-writer", "bytes", "source-and-size-of"),
(
"adapter-pending-memory",
"decoder-writer-output-capacity",
"bytes",
"source-and-size-of",
),
("adapter-size", "decoder-writer", "bytes", "source-and-size-of"),
(
"adapter-pending-memory",
"encoder-reader-output-capacity",
"bytes",
"source-and-size-of",
),
("adapter-size", "encoder-reader", "bytes", "source-and-size-of"),
(
"adapter-pending-memory",
"decoder-reader-output-capacity",
"bytes",
"source-and-size-of",
),
("adapter-size", "decoder-reader", "bytes", "source-and-size-of"),
}
BINARY_FEATURE_SETS = {
"default",
"no-default-features",
"simd",
"secrets",
"checked-backend",
}
EXPECTED_LENGTHS = {
"1",
"2",
"3",
"11",
"12",
"15",
"16",
"23",
"24",
"31",
"32",
"47",
"48",
"63",
"64",
"1024",
"65536",
}
EVIDENCE_ID = re.compile(r"[A-Za-z0-9][A-Za-z0-9._-]{0,63}\Z")
COMMIT_ID = re.compile(r"[0-9a-f]{40}\Z")
MANIFEST_ARTIFACTS = {
"admission.csv",
"availability.csv",
"binary-resources.csv",
"environment.json",
"raw-run-1.csv",
"raw-run-2.csv",
"resources-default.csv",
"resources-no-simd.csv",
"summary.csv",
}
MANIFEST_STATIC_METADATA = {
"comparison_crates": "base64=0.23.0,base64ct=1.8.3",
"minimum_backend_ratio_to_scalar": "0.95",
"reproducibility_ratio_range": "0.50..2.00",
"stack_bound_method": (
"source constants and size_of; not a dynamic call-stack measurement"
),
}