Skip to content

Commit

Permalink
feat: add mimalloc as global allocator
Browse files Browse the repository at this point in the history
  • Loading branch information
kpbaks committed May 28, 2024
1 parent 5c17f45 commit 6b26173
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ flamegraphs/*

*.json
!results/*.json

*.html
20 changes: 20 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/gbpplanner-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ serde_json = "1.0.116"
colorgrad = "0.6.2"
# open = "5.1.0"
ordered-float = "4.2.0"
mimalloc = "0.1.42"
# dialoguer = { version = "0.11.0", features = ["fuzzy-select"] }

# # TODO: change to not wasm
Expand Down
8 changes: 4 additions & 4 deletions crates/gbpplanner-rs/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ impl Plugin for ExportPlugin {
.add_event::<events::OpenLatestExport>()
.init_resource::<resources::SnapshottedRobots>()
.init_resource::<resources::LatestExport>()
.add_systems(
FixedUpdate,
send_default_export_event.run_if(once_after_delay(Duration::from_secs(60))),
)
// .add_systems(
// FixedUpdate,
// send_default_export_event.run_if(once_after_delay(Duration::from_secs(60))),
// )
.add_systems(
Update,
(
Expand Down
4 changes: 4 additions & 0 deletions crates/gbpplanner-rs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ pub(crate) mod macros;
#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;

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

use std::path::Path;

use bevy::{
Expand Down
6 changes: 3 additions & 3 deletions crates/gbpplanner-rs/src/ui/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ fn ui_settings_panel(
ui.separator();

// ui.label("Factors");
ui.label(egui::RichText::new("Factors").size(16.0));
ui.label(egui::RichText::new("Factors Enabled").size(16.0));

custom::grid("factors_enabled_grid", 2).show(ui, |ui| {
let copy = config.gbp.factors_enabled.clone();
Expand Down Expand Up @@ -474,7 +474,7 @@ fn ui_settings_panel(
// ui.spacing_mut().slider_width = ui.available_width() - (custom::SLIDER_EXTRA_WIDE + custom::SPACING);
ui.spacing_mut().slider_width = ui.available_width();
// let mut available_size = ui.available_size();
// available_size.x += 10.0;
// available_size.x += 10.0;
// let slider_response = ui.add_sized(available_size,
let slider_response = ui.add_enabled(
time_virtual.is_paused(),
Expand Down Expand Up @@ -903,7 +903,7 @@ fn ui_settings_panel(
});

ui.end_row();
ui.label("Exit when scenario finishes");
ui.label("Exit at End");
custom::float_right(ui, |ui| {
custom::toggle_ui(ui, &mut config.simulation.exit_application_on_scenario_finished);
});
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
cargo-pgo
cargo-flamegraph
cargo-license
cargo-release
# cargo-tree

# # cargo-profiler
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-circle-expertiment.fish
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ end

printf '%sinfo%s: starting experiment\n' (set_color green) (set_color normal) >&2

for seed in 0 31 227 252 805
for seed in 0 # 31 227 252 805
sed --regexp-extended "s/prng-seed\s*=\s*([0-9]+)/prng-seed = $seed/" -i $config_file
for num_robots in (seq 5 5 50)
sed --regexp-extended "s/robots:\s+(\d+)/robots: $num_robots/" -i $formation_file
Expand Down

0 comments on commit 6b26173

Please sign in to comment.