You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Coordinate formatting dominates large geometry outputs #15
Queries with large outputs spend much of their CPU formatting coordinates. Every latitude and longitude is written as out<<std::fixed<<std::setprecision(7)<<value (72 places in output_formats/output_{json,xml,csv,custom}.cc), which goes through glibc's general-purpose floating-point formatting.
Evidence
On the Nova Scotia test database (see #2), this query takes about 490 ms CPU even with all the changes in #12 (benchmark query q10, 14.5 MB of JSON output):
[out:json]; way[highway](44.60,-63.66,44.70,-63.52); out geom;
Overpass stores coordinates as fixed-point integers (units of 1e-7 degrees), and all output uses exactly 7 decimals. A small formatter can produce the same characters without general float formatting:
Fast path: scale by 1e7 and round.
Fallback: use snprintf("%.7f") near rounding ties.
The output must stay byte-identical. std::to_chars would be simpler, but it needs C++17, and the build pins -std=c++11.
Activity