Reproducing the benchmarks

Every speed comparison in this manual but one can be rerun with one script, examples/benchmarks/reproduce.rb; the exception, the decider against BKN on three machines (The decider against the C++ code of Bringmann, Künnemann and Nusser), has its own scripts and raw results in examples/benchmarks/cpp_compare/fd_cpp/ (see its README). It downloads the other programs and the data, builds the drivers, converts the data, checks the converted inputs against the checksums of the published runs, runs the benchmarks, and writes all the tables to output/reproduce/tables.md. It needs a Linux machine with the tools below; only CGAL (optional) has to be installed system-wide.

git clone https://github.com/sarielhp/FrechetDist.jl.git FrechetDist
cd FrechetDist
ruby examples/benchmarks/reproduce.rb check            # the tools that are missing
ruby examples/benchmarks/reproduce.rb --quick          # everything on small subsets
ruby examples/benchmarks/reproduce.rb                  # everything (about two days)
ruby examples/benchmarks/reproduce.rb distance exact   # some of the benchmarks
ruby examples/benchmarks/reproduce.rb --help           # the stages, benchmarks and options

The script stops at the start, listing every tool that is missing, and how to get it. Run it on an otherwise idle machine: the timings are only meaningful then.

What it needs

ToolForDebian/Ubuntu package
Julia (1.10 or later) and Rubyeverythingjulialang.org, ruby
the Julia package QuickEnvthe scripts of example_higher/julia -e 'using Pkg; Pkg.add("QuickEnv")'
git, curl, unzip, tardownloadsgit curl unzip tar
g++, GMPthe C++ programsg++ libgmp-dev
python3 with venv, cmakeFred, the Geolife converterpython3 python3-venv cmake
octavethe characters converter of BKNoctave
ffmpegthe KTH videosffmpeg
CGAL 6.0 or later (optional)the CGAL columnlibcgal-dev

Stages and options

ruby examples/benchmarks/reproduce.rb [options] [stage] [benchmark ...]

  • check: lists the missing tools of the benchmarks given (default: all). Besides the benchmarks, webpage names the data of the web page examples (the storks in data/birds/ and BKN's characters copied to data/characters/); it is set up with the benchmarks when none is given.
  • setup: downloads, builds, converts and checks; a part whose result is in place is skipped, and nothing that exists is deleted or overwritten.
  • run: runs the benchmarks. Each benchmark is a list of steps; a step writes output/reproduce/<benchmark>/<step>.log and, when it succeeds, <step>.done. A step that is done is skipped, so an interrupted run resumes where it stopped (--force runs the steps again). A step that fails ends its benchmark (the later steps may need its output); the other benchmarks still run. The package source measured (src/, Project.toml) is copied to output/reproduce/source/<digest>/, and each .done file and the header of the tables name its digest.
  • tables: writes output/reproduce/tables.md from what has run: the machine, the versions, and one section per benchmark.
  • all (the default): setup, run, tables.
  • --quick: small subsets of every benchmark (5 pairs per set, 3 query files per dataset, a few curves), to check that everything runs; results go to output/reproduce_quick/. The setup is the same (the downloads are about 6 GB).
  • --list lists the steps of each benchmark with their commands, which can also be run by hand from the root of the repository.

All the comparisons run on one thread (julia -t 1, OMP_NUM_THREADS=1), except the columns marked "all threads". Every driver reads its curves first, runs once untimed, and reports the minimum of three timed runs (one for the exact algorithms and the frog code).

The benchmarks

Each benchmark is sized to run in at most 10 minutes, about an hour in all. Every comparison is made in full on a smaller input: fewer pairs, query files, curves, clips or vertices than in the papers the inputs come from. Correctness checks (the answers compared with the other programs, the independent checks, the two methods of the exact distance) run on everything the benchmark computes.

BenchmarkReproducesSizeStepsMinutes
deciderthe older harness of cpp_compare (the last item of The decider against the C++ code of Bringmann, Künnemann and Nusser), with the trees built in the timed decisions (FD_MODE=exact_lazy) and when the curves are read (exact)40 query files per dataset (cpp_compare/sample40.txt), 1000 queries eachexamples/benchmarks/cpp_compare/run.rb2.3
decider_pidthe decider of run_queries_test.jl against the C++ codeevery 4th file of the samplethe same, FD_MODE=pid5.3
distanceThe distance: against BKN and CGALthe first 100 pairs of each set of the frog benchmarkexamples/benchmarks/frog/run.rb (bisect, bisect14, bkn, bkn14, cgal)4.4
exactThe frog benchmark of the exact distancethe first 50 pairs of each setexamples/benchmarks/frog/run.rb (exact, tables, sweep, dijkstra)6.8
fredHigh-dimensional curves: comparison with Fred: traffic and video, at 10⁻⁹ and 10⁻⁵, the exact distance on 1 and all threads, the independent checksPEMS days 1–10 (45 pairs), KTH clips 1–5 (10 pairs)example_higher/fred_curves.py, curves.jl, exact_curves.jl, check_frechet.jl8.2
hydraulicthe hydraulic curves (ℝ^6000) against Fred, and frechet_c_compute on the full curvesFred, ours and the exact distance on the first 50, 100 and 200 vertices; ours alone on all 2205example_higher/fred_hydraulic.py, hydraulic.jl, exact_curves.jl5.0
hilbertthe costs of Curves in Hilbert spaces: pairs of clips, accuracy40 clips at 40 × 30, 12 at 160 × 120example_higher/hilbert_timing.jl, hilbert_accuracy.jl3.3
kththe action recognition tables of Curves in Hilbert spaces, and McNemar's testsevery 15th query (52 validation and 58 test clips, against all the references), one Julia processexample_higher/kth_classify.jl (11 runs), mcnemar.rb8.6
mocapthe nearest neighbours of the motion-capture trials (example_higher/README.md, What to expect)all 41 trialsexample_higher/distance_matrix.jl, exact and 4 1.050.9
checksthe Checks of The exact distance: the two methods of frechet_c_compute_exact, and the narrow listing3000 small cases, 1500 walks, 3000 intervalsexamples/benchmarks/exact_checks.jl0.3
pointsstatic against vector points (Point types and high dimensions)example_higher/point_types.jl1.5

On 52 and 58 KTH queries only large differences in accuracy are significant; kth_classify.jl without every= classifies all 768 and 863 (about a day for the 11 runs).

What setup downloads and builds

Everything goes to raw/, data/ and example_higher/data/, which git ignores.

WhatFromPinned atInto
The C++ code of Bringmann, Künnemann and Nusser (BKN)gitlab.mpi-klsb.mpg.de/anusser/frechet_distancecommit 93f8d44raw/frechet/
GeoLife 1.3, the sigspatial curves, the UCI character trajectoriesthe URLs of their fetch_and_convert_data.shSHA-256raw/downloads/, converted in raw/frechet/test_data/benchmark/
The exact code of Conradi, van der Hoog and Rotenberg (frog)Zenodo 10.5281/zenodo.19074030SHA-256raw/frog/exactFrechetUnleashed/
Their test suite (Athens, Berlin, Chicago, Drifter, UniD)github.com/dacin21/discrete-subtrajectory-clustering-test-suitecommit 27c497braw/frog/discrete-subtrajectory-clustering-test-suite/
The pigeon tracks of Pollonara et al. (2017)Movebank CSV (copy on frechet.xyz)SHA-256raw/pigeons/, data/pigeons/
The white stork tracks of Rotics et al. (2018), for the web page examplesMovebank CSV (copy on frechet.xyz)SHA-256raw/downloads/, data/birds/
FredPyPI, Fred-Frechet==1.14.5versionraw/fred-venv/
PEMS-SF, KTH actions, hydraulic test rig, CMU motion captureUCI, KTH, CMU (the scripts of example_higher/)checksums of the curvesexample_higher/data/

The drivers are built into raw/build/: bkn_dist and bkn_dist_rtol14 (examples/benchmarks/frog/bkn_dist.cpp on BKN's code; the second on a copy of frechet_light.cpp whose stopping rule is max - min < 1e-14 min), cgal_dist, frog_driver (their sources with examples/benchmarks/frog/FreespaceVisualizer.h instead of the OpenCV visualizer), and BKN's decider driver, raw/frechet/build_bench/decider_bench. All are built with -O3 -march=native -fno-math-errno, as the C++ port of the decider is: BKN's code as there, CGAL and the frog code also with -ffp-contract=off, so that no product is fused into another rounding. These flags do not change the results (BKN's distances move by at most 9e-13, its decisions not at all), and BKN's default build (-O2 -g, with sqrt setting errno) is about 5 times slower.

Every converted input is checked against examples/benchmarks/reproduce/checksums.txt, and the setup stops on a mismatch. The KTH curves are checked too, but only with a warning: they depend on ffmpeg's decoder.

Things to know

  • Two Geolife conversions. BKN's query files name Geolife curves by number, so the decider benchmark uses their converter, unchanged (raw/frechet/test_data/benchmark/). The frog benchmark uses data/geolife, made by examples/datasets/geolife_download/geolife_converter.py, which keeps the trajectories that leave Beijing under other names and so numbers the rest differently; its first 300 files (by name) are the Geolife set of that benchmark.
  • Pigeons. examples/datasets/movebank_splice.jl splits the Movebank CSV into curves as the old downloader (download_data.jl, now archived) did in 2025, when the frog benchmark took its pigeon curves from this repository.
  • Storks. The Movebank page of the stork data now serves HTML instead of the CSV, so the setup downloads the copy on frechet.xyz; its curves are identical to those the old downloader made.
  • The frog benchmark's curves. examples/benchmarks/frog/prep.rb writes every curve of the benchmark as whitespace-separated x y lines: their pigeon files separate by commas, which their C++ reader and BKN's misread. The 200 pairs per set (110 for OV) are committed in examples/benchmarks/frog/pairs/; prep.rb draws them again and warns if this Ruby draws others.
  • Exact integer coordinates. The frog code reads coordinates as integers, scaled and truncated. run.rb scales by 10^6 for pigeons and drifter, 10^7 for unid and 10^5 otherwise: exact for pigeons, athens, OV, drifter and unid, where the values of the others are compared with it. A frog run longer than 60 s is stopped and counted as 60 s.
  • Threads. Only frechet_c_compute_exact uses more than one thread, to build its tables; the tables mark the runs on all threads.

The files

examples/benchmarks/reproduce.rb : The command line: stages, options, help.

examples/benchmarks/reproduce/common.rb : Paths, running commands, and the checksums of files and directories.

examples/benchmarks/reproduce/setup.rb : The setup stage: tools, downloads (URLs and SHA-256), git checkouts, builds, conversions.

examples/benchmarks/reproduce/benchmarks.rb : The benchmarks and their steps, and running them.

examples/benchmarks/reproduce/tables.rb : The tables stage.

examples/benchmarks/reproduce/checksums.txt : The SHA-256 of the converted inputs of the published runs.

examples/benchmarks/frog/prep.rb : The curves and pairs of the frog benchmark, into raw/frog/bench_data/.

examples/benchmarks/frog/pairs/ : The pairs of each set (<set>.pairs, paths relative to raw/frog/bench_data/).

examples/benchmarks/frog/run.rb : Runs one program (bisect, bisect14, bkn, bkn14, cgal, exact, tables, sweep, dijkstra) on the pairs: one line per pair, the distance and the time in ms.

examples/benchmarks/frog/summarize.rb : The tables of the frog benchmark: total time per set and program, pairs won, and the accuracy against the exact values of the frog code.

examples/benchmarks/frog/fd_bisect.jl, examples/benchmarks/frog/fd_exact.jl, examples/benchmarks/frog/read_curve.jl : FrechetDist's drivers: frechet_c_compute_bisect (atol and rtol given), and frechet_c_compute_exact (the default method or method = :tables).

examples/benchmarks/frog/bkn_dist.cpp, examples/benchmarks/frog/cgal_dist.cpp, examples/benchmarks/frog/frog_driver.cpp : The drivers of BKN's FrechetLight::calcDistance, CGAL's bounded_error_Frechet_distance (error 1e-10), and the frog code (sweep line or Dijkstra search).

examples/benchmarks/frog/FreespaceVisualizer.h : A stub for the frog code's OpenCV visualizer, which the benchmark never shows.

examples/benchmarks/cpp_compare/README.md : The decider benchmark: its setup, results, and pitfalls.

examples/benchmarks/cpp_compare/run.rb, examples/benchmarks/cpp_compare/summarize.rb : Run the decider benchmark (environment FD_MODE, PROGRAMS, TAG, OUT, SAMPLE), and its totals, the breakdown by query offset, and the disagreements.

examples/benchmarks/cpp_compare/decider_bench.cpp, examples/benchmarks/cpp_compare/fd_bench.jl : The two drivers of the decider benchmark: BKN's lessThanWithFilters, and frechet_c_decide_exact (modes exact, exact_lazy, exact_plain) or the decider of run_queries_test.jl (pid).

examples/benchmarks/cpp_compare/sample40.txt : The 40 query files per dataset of the sample (drawn once with a fixed seed).

examples/benchmarks/cpp_compare/fd_cpp/README.md : The decider comparison of The decider against the C++ code of Bringmann, Künnemann and Nusser: how to rerun it, on this machine or another.

examples/benchmarks/cpp_compare/fd_cpp/fd_decider.h, examples/benchmarks/cpp_compare/fd_cpp/fd_decider.cpp : frechet_c_decide_exact ported to C++ line by line (not part of the package).

examples/benchmarks/cpp_compare/fd_cpp/fd_bench.cpp, examples/benchmarks/cpp_compare/fd_cpp/build.rb : BKN's decider and the port in one program (modes pass, their, answers, per_query), and its builds at -O3 and -O2 with the same flags for both.

examples/benchmarks/cpp_compare/fd_cpp/bench.rb, examples/benchmarks/cpp_compare/fd_cpp/pass.jl : The timed runs of the comparison (alternating rounds, whole passes), for the port and BKN, and for the Julia package.

examples/benchmarks/cpp_compare/fd_cpp/summarize.rb, examples/benchmarks/cpp_compare/fd_cpp/plot.jl : The tables of the comparison from its raw results, and its figures (docs/src/assets/decider_speedup.svg, docs/src/assets/decider_delta.svg).

examples/benchmarks/cpp_compare/fd_cpp/queries/convert.rb, examples/benchmarks/cpp_compare/fd_cpp/queries/make_queries.rb : The curves of Porto taxi trips and Mopsi routes in BKN's format, and the queries with known answers from pairs of curves and their distance.

examples/benchmarks/cpp_compare/fd_cpp/queries/pairs/, examples/benchmarks/cpp_compare/fd_cpp/queries/queries.sha256 : The pairs of Porto and Mopsi (drawn by BKN's generator) and of the benchmark of Conradi et al., with their distance; the sha256 sums of the query files made from them.

examples/benchmarks/cpp_compare/fd_cpp/results/ : The raw results of the three machines (results/README.md describes the files).

examples/benchmarks/exact_checks.jl : Checks of frechet_c_compute_exact: the default method and method = :tables give the same value on random small curves (1 to 4 dimensions, grids, collinear curves) and planar random walks, and the narrow listing of critical values equals the full one on short intervals. Exits with status 1 on a difference.

examples/datasets/movebank_splice.jl : The curves of data/pigeons/ and data/birds/ from their Movebank CSVs.

The scripts of example_higher/ that the benchmarks run are described in High-dimensional curves: comparison with Fred and Curves in Hilbert spaces; their files are listed in The repository.