Compare commits

...
2 Commits
Author SHA1 Message Date
randy 54e811ef95 chore(deps): update dependency suncalc to v2.1.4
CI / check (pull_request) Successful in 17s
CI / deploy (pull_request) Skipped
CI / check (push) Successful in 17s
CI / deploy (push) Successful in 13s
2026-11-12 11:52:17 +00:00
randy e63f6f7ce7 Enable YJIT in the container
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 1m2s
The official Ruby image ships YJIT but leaves it off. Set via ENV so the
puma server and rake jobs run through podman compose exec both get it.
2026-11-12 12:27:42 +01:00
4 changed files with 19 additions and 10 deletions

No files matched your search

+5
View File
@@ -3,6 +3,11 @@
# bookworm-backports doesn't carry a newer one either, only trixie's does. # bookworm-backports doesn't carry a newer one either, only trixie's does.
FROM ruby:4.0.9-slim-trixie FROM ruby:4.0.9-slim-trixie
# YJIT is compiled into the official image but off unless asked for. Set
# here rather than as a puma flag so `podman compose exec ... rake` jobs
# (places:index, gpx backfills) get it too.
ENV RUBY_YJIT_ENABLE=1
# build-essential: puma has a native (C) extension; harmless if the # build-essential: puma has a native (C) extension; harmless if the
# platform-specific gem in Gemfile.lock already has a precompiled binary # platform-specific gem in Gemfile.lock already has a precompiled binary
# matching this base image, but keeps the build working if it doesn't. # matching this base image, but keeps the build working if it doesn't.
+4 -4
View File
@@ -11,7 +11,7 @@
"maplibre-gl": "6.17.0", "maplibre-gl": "6.17.0",
"maplibre-gl-lanes": "1.4.1", "maplibre-gl-lanes": "1.4.1",
"pmtiles": "4.5.0", "pmtiles": "4.5.0",
"suncalc": "2.1.3" "suncalc": "2.1.4"
} }
}, },
"node_modules/@mapbox/jsonlint-lines-primitives": { "node_modules/@mapbox/jsonlint-lines-primitives": {
@@ -304,9 +304,9 @@
} }
}, },
"node_modules/suncalc": { "node_modules/suncalc": {
"version": "2.1.3", "version": "2.1.4",
"resolved": "https://registry.npmjs.org/suncalc/-/suncalc-2.1.3.tgz", "resolved": "https://registry.npmjs.org/suncalc/-/suncalc-2.1.4.tgz",
"integrity": "sha512-7DWCsxPKRPMtylyGqSrgNBr+pseyczJGqb4NCpW2EziwNHaSuHc9w1lL4i91IyDw5CnPUWqBNBWyd/vFjr4rTw==", "integrity": "sha512-V7oSdbSezigEpbqnNWKujDlZaE/QA/0w5IbP/vXX+eIF+EtiE8e9BkSapsOFZc84jJkI3QlklYTWtMqzj9tZQg==",
"dev": true "dev": true
}, },
"node_modules/tinyqueue": { "node_modules/tinyqueue": {
+1 -1
View File
@@ -8,6 +8,6 @@
"maplibre-gl": "6.17.0", "maplibre-gl": "6.17.0",
"maplibre-gl-lanes": "1.4.1", "maplibre-gl-lanes": "1.4.1",
"pmtiles": "4.5.0", "pmtiles": "4.5.0",
"suncalc": "2.1.3" "suncalc": "2.1.4"
} }
} }
+9 -5
View File
@@ -142,16 +142,18 @@ function solarTransit(dt, lw) {
// time the Sun reaches altitude h0 within the half day [a, b] between transit and nadir, given the // time the Sun reaches altitude h0 within the half day [a, b] between transit and nadir, given the
// sine of its altitude at both ends; NaN if it doesn't cross h0 there (altitude is monotonic over the // sine of its altitude at both ends; NaN if it doesn't cross h0 there (altitude is monotonic over the
// half day, so a sign change means exactly one crossing). Seeds from the hour angle at transit // half day, so a sign change means exactly one crossing). Seeds from the hour angle at transit
// declination, then Newton on sin(h) kept inside a shrinking bracket, bisecting whenever a step // declination, then Newton on sin(h) kept inside a shrinking bracket, bisecting whenever a step leaves
// leaves it — on near-grazing days the slope is tiny and plain Newton steps land days away. // it or fails to halve the previous step (as in rtsafe) — on near-grazing days the slope is tiny, so
// plain Newton steps land days away or ping-pong inside the bracket, barely shrinking it.
function getSetJ(h0, a, b, sa, sb, dt, lw, phi, decT) { function getSetJ(h0, a, b, sa, sb, dt, lw, phi, decT) {
const s0 = sin(h0); const s0 = sin(h0);
const rising = sa < sb; const rising = sa < sb;
if ((sa - s0) * (sb - s0) > 0) return NaN; // sun stays above / below this altitude all half day if (!((sa - s0) * (sb - s0) <= 0)) return NaN; // stays above / below h0 all half day, or NaN input
const cosH0 = (s0 - sin(phi) * sin(decT)) / (cos(phi) * cos(decT)); const cosH0 = (s0 - sin(phi) * sin(decT)) / (cos(phi) * cos(decT));
const H0 = cosH0 <= -1 ? PI : cosH0 >= 1 ? 0 : acos(cosH0); const H0 = cosH0 <= -1 ? PI : cosH0 >= 1 ? 0 : acos(cosH0);
let d = dt + (rising ? -H0 : H0) / (2 * PI); let d = dt + (rising ? -H0 : H0) / (2 * PI);
let dx = b - a;
for (;;) { for (;;) {
const c = sunCoords(toDaysTT(d)); const c = sunCoords(toDaysTT(d));
@@ -161,11 +163,13 @@ function getSetJ(h0, a, b, sa, sb, dt, lw, phi, decT) {
if ((f < 0) === rising) a = d; else b = d; if ((f < 0) === rising) a = d; else b = d;
const step = f / (2 * PI * k * sin(H)); const step = f / (2 * PI * k * sin(H));
if (d + step > a && d + step < b) { if (d + step > a && d + step < b && abs(step) <= abs(dx) / 2) {
dx = step;
d += step; d += step;
if (abs(step) < 1e-5) return d; // ~1 s step, so quadratic convergence leaves ~µs error if (abs(step) < 1e-5) return d; // ~1 s step, so quadratic convergence leaves ~µs error
} else { } else {
d = (a + b) / 2; dx = (b - a) / 2;
d = a + dx;
if (b - a < 1e-8) return d; if (b - a < 1e-8) return d;
} }
} }