Skip to content

Commit

Permalink
cli: use mimalloc from jj-cbits as the default memory allocator
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Seipp <[email protected]>
Change-Id: I522b80f0fcfe3173c1412cdd9f49d127
  • Loading branch information
thoughtpolice committed Mar 11, 2024
1 parent 552f0b1 commit 0a3c7ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ gix = { workspace = true }
hex = { workspace = true }
indexmap = { workspace = true }
itertools = { workspace = true }
jj-cbits = { workspace = true }
jj-lib = { workspace = true }
maplit = { workspace = true }
minus = { workspace = true }
Expand Down Expand Up @@ -89,8 +90,9 @@ testutils = { workspace = true }
jj-cli = { path = ".", features = ["test-fakes"], default-features = false }

[features]
default = ["watchman"]
default = ["watchman", "mimalloc"]
bench = ["dep:criterion"]
mimalloc = []
packaging = []
test-fakes = ["jj-lib/testing"]
vendored-openssl = ["git2/vendored-openssl", "jj-lib/vendored-openssl"]
Expand Down
6 changes: 6 additions & 0 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(feature = "mimalloc")]
use jj_cbits::mimalloc::MiMalloc;
use jj_cli::cli_util::CliRunner;

#[cfg(feature = "mimalloc")]
#[global_allocator]
static ALLOC: MiMalloc = MiMalloc;

fn main() -> std::process::ExitCode {
CliRunner::init().version(env!("JJ_VERSION")).run()
}

0 comments on commit 0a3c7ce

Please sign in to comment.