mamba vs conda: より速いcondaのsolver?
mambaはずっと速いC++の依存関係solverを備えたcondaのドロップイン式の代替です。condaはオリジナルで、現在はlibmamba solverも同梱しています。
mambaはcondaコマンドを、並列ダウンロードとより速いSAT solverを用いてC++で再実装し、同じchannelとenvironment.ymlを読みつつ、環境作成を数分から数秒に短縮することがよくあります。最近のcondaバージョンはlibmamba solverを同梱し、差を縮めていますが、mamba(およびmicromamba)は依然としてCI向けにより速く軽量な傾向があります。大半のworkflowでは両者は交換可能です。
| mamba | conda | |
|---|---|---|
| Solver | 高速なC++ (libsolv) | classicまたはlibmamba |
| 速度 | 最速 | libmambaで改善 |
| 互換性 | conda互換 | リファレンス |
| フットプリント | 軽量 (micromamba) | 重めのベース |
| 最適な用途 | CI、高速なsolve | 既存のcondaセットアップ |
CIでは
mambaとmicromambaは、遅いcondaのsolveがセットアップ時間を支配するCIで真価を発揮します。micromambaはベース環境を持たない単一の静的バイナリで、使い捨てのrunnerに理想的です。すでにcondaを使っているなら、libmamba solverを有効にすることで、ツールを切り替えずに恩恵の大半を得られます。
高速化
solveがウォームになるよう、environment.ymlをキーにしてpackage cacheをcacheしましょう。どちらもCI runner上で実行されます。より高速なマネージドrunnerは、インストールとsolveのステップをさらに短縮します。
Decide with your own numbers, not a feature table
Feature comparisons age badly and rarely decide anything, because both tools in a mature category can do the job. What differs is how each behaves on your repository, and that takes one afternoon to measure.
# time a cold install with each candidate, cache cleared
hyperfine --prepare "rm -rf node_modules" --warmup 1 \
"<tool-a> install" "<tool-b> install"
# and the thing CI actually pays for: a cold run with no local cache
docker run --rm -v "$(pwd):/w" -w /w node:22 sh -c "<tool> install"What actually changes when you switch
- Lockfile format. A switch is a one-way door for anyone still on the old tool until everyone migrates, so plan it as a single coordinated change.
- Resolution strictness. Tools differ on whether an undeclared transitive import works, and the stricter one will surface latent bugs as new failures.
- CI cache configuration. The cache path and key differ per tool; carrying over the old ones silently disables caching.
- Everyone on the team and every runner must move together. Pin the version so they cannot drift.
結論
最速かつ最軽量の環境作成を求める新しいCIセットアップ: micromambaまたはmamba。既存のcondaプロジェクト: libmamba solverを有効にすれば、ツールを変えずに速度の大半を得られます。両者は同じchannelとファイルを読むため、切り替えは低リスクです。