R Ecology vegan

Speed up vegan adonis2

vegan adonis2 is one of the slower steps in many ecology workflows. AutoZyme ships a verified, drop-in patch that is up to 239.1× faster, returning output within a strict, verified tolerance with no change to how you call it.

Best speedup 239.1×
Median speedup 109.2×
Output equivalence Tolerance
Best runtime baseline 13.75 min optimized 3.45 s
Datasets 5
Pass rate 10/10

Benchmark charts

Switch benchmark platform; all charts update together
Platform
Speedup distribution
Each dot is one finalized dataset/thread run on Windows
log scale
sim_n5000_p500pbmc200k_glaucoma_cel…tms_ss2_tissue_n3500_…sim_n3500_p400sim_n2000_p300
Thread sweep
Speedup across finalized thread counts on Windows
250×500×14full (8)sim_n5000_p500 · large1 threads · 165.7× speedup13.75 min baseline → 4.98 s optimizedmemory 1.6 GB → 1.9 GBsim_n5000_p500 · large4 threads · 226.9× speedup13.75 min baseline → 3.64 s optimizedmemory 1.6 GB → 1.9 GBsim_n5000_p500 · large8 threads · 239.1× speedup13.75 min baseline → 3.45 s optimizedmemory 1.6 GB → 1.9 GBpbmc200k_glaucoma_celltype_n5500_p800 · ood_xlarge1 threads · 124.4× speedup17.45 min baseline → 8.41 s optimizedmemory 2.1 GB → 2.2 GBpbmc200k_glaucoma_celltype_n5500_p800 · ood_xlarge4 threads · 202.5× speedup17.45 min baseline → 5.17 s optimizedmemory 2.1 GB → 2.2 GBpbmc200k_glaucoma_celltype_n5500_p800 · ood_xlarge8 threads · 236.8× speedup17.45 min baseline → 4.43 s optimizedmemory 2.1 GB → 2.2 GBtms_ss2_tissue_n3500_p800 · ood_large1 threads · 132.2× speedup7.57 min baseline → 3.47 s optimizedmemory 1.0 GB → 1.1 GBtms_ss2_tissue_n3500_p800 · ood_large4 threads · 164.1× speedup7.57 min baseline → 2.77 s optimizedmemory 1.0 GB → 1.1 GBtms_ss2_tissue_n3500_p800 · ood_large8 threads · 176.1× speedup7.57 min baseline → 2.58 s optimizedmemory 1.0 GB → 1.1 GBsim_n3500_p400 · medium1 threads · 131.2× speedup6.82 min baseline → 3.12 s optimizedmemory 1.0 GB → 1.1 GBsim_n3500_p400 · medium4 threads · 168.9× speedup6.82 min baseline → 2.42 s optimizedmemory 1.0 GB → 1.0 GBsim_n3500_p400 · medium8 threads · 169.7× speedup6.82 min baseline → 2.41 s optimizedmemory 1.0 GB → 1.1 GBsim_n2000_p300 · small1 threads · 82.1× speedup1.83 min baseline → 1.34 s optimizedmemory 0.5 GB → 0.6 GBsim_n2000_p300 · small4 threads · 81.4× speedup1.83 min baseline → 1.35 s optimizedmemory 0.5 GB → 0.6 GBsim_n2000_p300 · small8 threads · 86.8× speedup1.83 min baseline → 1.27 s optimizedmemory 0.5 GB → 0.6 GB
sim_n5000_p500pbmc200k_glaucoma_c…tms_ss2_tissue_n350…sim_n3500_p400sim_n2000_p300
Memory
Baseline vs optimized peak memory on Windows
0.0 GB2.5 GB5.0 GBpbmc200k_glaucoma…1.05×sim_n5000_p5001.22×tms_ss2_tissue_n3…1.07×sim_n3500_p4001.12×sim_n2000_p3001.17×pbmc200k_glaucoma_celltype_n5500_p800 · ood_xlargememory 2.1 GB → 2.2 GBoptimized / baseline 1.05×236.8× speedup · 8 threadssim_n5000_p500 · largememory 1.6 GB → 1.9 GBoptimized / baseline 1.22×239.1× speedup · 8 threadstms_ss2_tissue_n3500_p800 · ood_largememory 1.0 GB → 1.1 GBoptimized / baseline 1.07×176.1× speedup · 8 threadssim_n3500_p400 · mediummemory 1.0 GB → 1.1 GBoptimized / baseline 1.12×169.7× speedup · 8 threadssim_n2000_p300 · smallmemory 0.5 GB → 0.6 GBoptimized / baseline 1.17×86.8× speedup · 8 threads
baselineoptimized

What is accelerated

The public API stays the same; AutoZyme replaces only the supported fast path.

This task targets vegan · adonis2 in vegan. The benchmarked result preserves the declared scientific output gate while reducing CPU runtime on the listed datasets.

Also searched as: PERMANOVA, adonis, beta diversity, community ecology, permutational anova.

Supported scope

The fast path correctly handles the by="terms", model="reduced" dbRDA (distance-based RDA) PERMANOVA path with NO conditioning/partial term (no Condition() / Z block) and NON-classical-CCA (no row weights). Read full supported scope

The fast path correctly handles the by="terms", model="reduced" dbRDA (distance-based RDA) PERMANOVA path with NO conditioning/partial term (no Condition() / Z block) and NON-classical-CCA (no row weights). Concretely: (1) fast_adonis2 accelerates only method="bray" with no extra ... args and parallelDist installed; it accepts either a precomputed dist LHS or a count matrix/data.frame LHS (built into Bray via parallelDist::parDist). It still honors sqrt.dist, add=lingoes/cailliez, na.action, strata, and permutations by routing them through the original vegan code paths. (2) fast_adonis0 builds the dbRDA fit directly from the doubly-centered Gram + a single qr() only when there is no Z conditioning block and no extra dots. (3) fast_permutest_cca runs the bounded-batch trace engine only when model=="reduced" AND by=="terms" AND first==FALSE AND not partial (no pCCA) AND not classical CCA (no RW weights) AND inherits "dbrda" AND x$CCA$rank>0. Permutation count (default 999), strata, and seed are all respected; results are bit-identical to upstream for the supported branch (changelog reports F0 ~4e-8, F.perm ~8e-13 vs unpatched reference). Memory is bounded to O(batch_perms) via getOption("autozyme.vegan.perm_batch",128L).

Out-of-scope behavior

silent fallback to upstream

Show detailed speedup table 10 runs
Dataset Tier Platform Threads Baseline Optimized Speedup Memory Concordance Pass
pbmc200k_glaucoma_celltype_n5500_p800 ood_xlarge Windows 8 17.45 min 4.43 s 236.8× 2.1 → 2.2 GB pass
sim_n2000_p300 small Windows 8 1.83 min 1.27 s 86.8× 0.5 → 0.6 GB pass
sim_n3500_p400 medium Windows 8 6.82 min 2.41 s 169.7× 1.0 → 1.1 GB pass
sim_n5000_p500 large Windows 8 13.75 min 3.45 s 239.1× 1.6 → 1.9 GB pass
tms_ss2_tissue_n3500_p800 ood_large Windows 8 7.57 min 2.58 s 176.1× 1.0 → 1.1 GB pass
pbmc200k_glaucoma_celltype_n5500_p800 ood_xlarge macOS 1 19.81 min 11.34 s 104.9× 3.8 → 3.5 GB pass
sim_n2000_p300 small macOS 1 1.48 min 3.93 s 22.6× 0.8 → 0.7 GB pass
sim_n3500_p400 medium macOS 1 5.06 min 11.41 s 26.6× 1.3 → 1.4 GB pass
sim_n5000_p500 large macOS 1 10.25 min 5.42 s 113.5× 2.4 → 2.3 GB pass
tms_ss2_tissue_n3500_p800 ood_large macOS 1 7.00 min 18.44 s 22.8× 1.3 → 1.5 GB pass

Frequently asked questions

Speeding up vegan adonis2
Why is vegan adonis2 slow?

vegan adonis2 is CPU-bound, and the stock implementation in vegan leaves performance on the table in its core numerical work. On the benchmark datasets the original takes 13.75 min where the AutoZyme path takes 3.45 s (239.1× faster).

How do I make vegan adonis2 faster?

Install AutoZyme and activate the vegan patch, then keep using vegan adonis2 exactly as before. AutoZyme transparently substitutes the faster, output-validated path, up to 239.1× faster on the benchmark datasets, with no pipeline or API changes.

Does the AutoZyme speedup change the vegan adonis2 output?

Effectively no. The output is tolerance-equivalent: held within a frozen concordance gate (up to about 0.6% drift from the original vegan result) on every benchmark dataset.

How do I install the vegan speedup?

In R: install the autozyme package, then run library(autozyme) and autozyme::activate("vegan"). The patch applies automatically the next time you call vegan adonis2.