Profiled jemallocator

Fortune for day14's current commit: Future blessing − 末吉
master
Avril 2 years ago
parent 253ee34a91
commit 99a39cf5dc
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -0,0 +1,2 @@
# Rework a more efficient one usinc `memchr2()`
We can `memchr2('\n','\n', mapped_file_memory)` on a `mmap()`'d input file to find the grouping seperators, and process each group in parallel

28
day14/Cargo.lock generated

@ -62,6 +62,7 @@ name = "day14"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"color-eyre", "color-eyre",
"jemallocator",
"linebuffer", "linebuffer",
] ]
@ -75,6 +76,12 @@ dependencies = [
"once_cell", "once_cell",
] ]
[[package]]
name = "fs_extra"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
[[package]] [[package]]
name = "gimli" name = "gimli"
version = "0.27.0" version = "0.27.0"
@ -87,6 +94,27 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
[[package]]
name = "jemalloc-sys"
version = "0.5.2+5.3.0-patched"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "134163979b6eed9564c98637b710b40979939ba351f59952708234ea11b5f3f8"
dependencies = [
"cc",
"fs_extra",
"libc",
]
[[package]]
name = "jemallocator"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16c2514137880c52b0b4822b563fadd38257c1f380858addb74a400889696ea6"
dependencies = [
"jemalloc-sys",
"libc",
]
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.138" version = "0.2.138"

@ -16,6 +16,12 @@ inherits="release"
#incremental=true #incremental=true
strip=false strip=false
[features]
default= [ "jemallocator" ]
status = ["jemallocator/profiling"]
[dependencies] [dependencies]
color-eyre = { version = "0.6.2", default-features = false } color-eyre = { version = "0.6.2", default-features = false }
jemallocator = { version = "0.5.0", optional = true }
linebuffer = { path = "/home/avril/work/linebuffer" } linebuffer = { path = "/home/avril/work/linebuffer" }

@ -24,6 +24,14 @@ use linebuffer::{
buf::forward, buf::forward,
}; };
#[cfg(feature="jemallocator")]
const _:() = {
use jemallocator::Jemalloc;
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;
};
mod ext { mod ext {
use super::iter::{ use super::iter::{
self, self,
@ -239,7 +247,7 @@ fn main() -> eyre::Result<()> {
.wrap_err("Failed to parse input")?; .wrap_err("Failed to parse input")?;
//TODO: Deconstruct each `Line` into the horizontal and vertical movements //TODO: Deconstruct each `Line` into the horizontal and vertical movements
//eprintln!("{input:#?}"); eprintln!("{input:#?}");
println!("{}", input.zipped_len()); println!("{}", input.zipped_len());
//TODO: Draw lines into grid before starting simulation of sand from `ORIGIN_POINT`. //TODO: Draw lines into grid before starting simulation of sand from `ORIGIN_POINT`.

Loading…
Cancel
Save