commit 9b41b7ce4482189b890de916082e056d3d0ac019 Author: Mahdi Dibaiee Date: Thu Jun 16 12:50:08 2022 +0100 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..37b9dd0 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,304 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cc" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "dhat" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47003dc9f6368a88e85956c3b2573a7e6872746a3e5d762a8885da3a136a0381" +dependencies = [ + "backtrace", + "lazy_static", + "parking_lot", + "rustc-hash", + "serde", + "serde_json", + "thousands", +] + +[[package]] +name = "gimli" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "itoa" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" + +[[package]] +name = "lock_api" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "miniz_oxide" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" +dependencies = [ + "adler", +] + +[[package]] +name = "object" +version = "0.28.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" +dependencies = [ + "memchr", +] + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "proc-macro2" +version = "1.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +dependencies = [ + "bitflags", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "ryu" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "serde" +version = "1.0.137" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.137" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "smallvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" + +[[package]] +name = "syn" +version = "1.0.96" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thousands" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" + +[[package]] +name = "unicode-ident" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "zero-copy-deserialize" +version = "0.1.0" +dependencies = [ + "dhat", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..6467266 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "zero-copy-deserialize" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +dhat = "0.3.0" + +[profile.release] +debug = 1 + +[features] +dhat-heap = [] # if you are doing heap profiling +dhat-ad-hoc = [] # if you are doing ad hoc profiling diff --git a/dhat-ad-hoc.json b/dhat-ad-hoc.json new file mode 100644 index 0000000..6cf6b45 --- /dev/null +++ b/dhat-ad-hoc.json @@ -0,0 +1,39 @@ +{ +"dhatFileVersion": 2, +"mode": "rust-ad-hoc", +"verb": "Allocated", +"bklt": false, +"bkacc": false, +"bu": "unit", +"bsu": "units", +"bksu": "events", +"tu": "µs", +"Mtu": "s", +"cmd": "target/debug/zero-copy-deserialize", +"pid": 42993, +"te": 250, +"pps": [ +{ +"tb": 100, +"tbk": 1, +"fs": [ +1, +2 +] +}, +{ +"tb": 100, +"tbk": 1, +"fs": [ +1, +3 +] +} +], +"ftbl": [ +"[root]", +"0x100047454: dhat::ad_hoc_event (dhat-0.3.0/src/lib.rs:1322:18)", +"0x10003dd08: zero_copy_deserialize::main (zero-copy-deserialize/src/main.rs:36:5)", +"0x10003dde4: zero_copy_deserialize::main (zero-copy-deserialize/src/main.rs:44:5)" +] +} \ No newline at end of file diff --git a/dhat-heap.json b/dhat-heap.json new file mode 100644 index 0000000..ffa85cc --- /dev/null +++ b/dhat-heap.json @@ -0,0 +1,237 @@ +{ +"dhatFileVersion": 2, +"mode": "rust-heap", +"verb": "Allocated", +"bklt": true, +"bkacc": false, +"tu": "µs", +"Mtu": "s", +"tuth": 10, +"cmd": "target/debug/zero-copy-deserialize", +"pid": 43081, +"tg": 272, +"te": 291, +"pps": [ +{ +"tb": 8192, +"tbk": 1, +"tl": 112, +"mb": 8192, +"mbk": 1, +"gb": 8192, +"gbk": 1, +"eb": 8192, +"ebk": 1, +"fs": [ +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, +13, +14, +15, +16, +17, +18 +] +}, +{ +"tb": 8, +"tbk": 1, +"tl": 51, +"mb": 8, +"mbk": 1, +"gb": 0, +"gbk": 0, +"eb": 0, +"ebk": 0, +"fs": [ +19, +20, +21, +22, +23, +24, +25, +26, +27, +28, +29, +30, +31, +32, +33, +34, +18 +] +}, +{ +"tb": 64, +"tbk": 1, +"tl": 95, +"mb": 64, +"mbk": 1, +"gb": 64, +"gbk": 1, +"eb": 64, +"ebk": 1, +"fs": [ +35, +36, +37, +38, +39, +40, +41, +42, +43, +11, +12, +13, +14, +15, +16, +17, +18 +] +}, +{ +"tb": 4, +"tbk": 1, +"tl": 34, +"mb": 4, +"mbk": 1, +"gb": 4, +"gbk": 1, +"eb": 0, +"ebk": 0, +"fs": [ +44, +45, +46, +47, +48, +49, +50, +51, +52, +53, +54, +18 +] +}, +{ +"tb": 1024, +"tbk": 1, +"tl": 19, +"mb": 1024, +"mbk": 1, +"gb": 1024, +"gbk": 1, +"eb": 1024, +"ebk": 1, +"fs": [ +55, +56, +57, +58, +59, +60, +61, +62, +63, +64, +65, +11, +66, +67, +68, +69, +70, +71 +] +} +], +"ftbl": [ +"[root]", +"0x10488971c: ::allocate (alloc/src/alloc.rs:231:9)", +"0x10488971c: alloc::raw_vec::RawVec::allocate_in (alloc/src/raw_vec.rs:185:45)", +"0x10488971c: alloc::raw_vec::RawVec::with_capacity_in (alloc/src/raw_vec.rs:132:9)", +"0x10488971c: alloc::raw_vec::RawVec::with_capacity (alloc/src/raw_vec.rs:93:9)", +"0x10488971c: alloc::boxed::Box<[T]>::new_uninit_slice (alloc/src/boxed.rs:616:18)", +"0x10488971c: std::io::buffered::bufreader::BufReader::with_capacity (io/buffered/bufreader.rs:96:19)", +"0x10488971c: std::io::stdio::stdin::{{closure}} (src/io/stdio.rs:324:24)", +"0x10488971c: std::lazy::SyncOnceCell::get_or_init::{{closure}} (std/src/lazy.rs:281:50)", +"0x10488971c: std::lazy::SyncOnceCell::initialize::{{closure}} (std/src/lazy.rs:462:19)", +"0x10488971c: std::sync::once::Once::call_once_force::{{closure}} (src/sync/once.rs:334:40)", +"0x1048a67c4: std::sync::once::Once::call_inner (src/sync/once.rs:434:21)", +"0x1048a691c: std::sync::once::Once::call_once_force (src/sync/once.rs:334:9)", +"0x1048a691c: std::lazy::SyncOnceCell::initialize (std/src/lazy.rs:461:9)", +"0x1048865b4: std::lazy::SyncOnceCell::get_or_try_init (std/src/lazy.rs:328:9)", +"0x1048865b4: std::lazy::SyncOnceCell::get_or_init (std/src/lazy.rs:281:15)", +"0x1048865b4: std::io::stdio::stdin (src/io/stdio.rs:323:16)", +"0x104766b58: zero_copy_deserialize::mamad (zero-copy-deserialize/src/main.rs:19:17)", +"0x104766c20: zero_copy_deserialize::main (zero-copy-deserialize/src/main.rs:32:13)", +"0x104766d88: __rg_alloc (zero-copy-deserialize/src/main.rs:5:15)", +"0x1048761d8: alloc::raw_vec::finish_grow (alloc/src/raw_vec.rs:0:0)", +"0x1048a6210: alloc::raw_vec::RawVec::grow_amortized (alloc/src/raw_vec.rs:400:19)", +"0x1048a6210: alloc::raw_vec::RawVec::reserve::do_reserve_and_handle (alloc/src/raw_vec.rs:285:28)", +"0x104887d40: alloc::raw_vec::RawVec::reserve (alloc/src/raw_vec.rs:289:13)", +"0x104887d40: alloc::vec::Vec::reserve (src/vec/mod.rs:813:9)", +"0x104887d40: alloc::vec::Vec::append_elements (src/vec/mod.rs:1798:9)", +"0x104887d40: as alloc::vec::spec_extend::SpecExtend<&T,core::slice::iter::Iter>>::spec_extend (src/vec/spec_extend.rs:85:18)", +"0x104887d40: alloc::vec::Vec::extend_from_slice (src/vec/mod.rs:2236:9)", +"0x104887d40: std::io::read_until (src/io/mod.rs:1892:21)", +"0x1048866c0: std::io::BufRead::read_line::{{closure}} (src/io/mod.rs:2176:44)", +"0x1048866c0: std::io::append_to_string (src/io/mod.rs:336:15)", +"0x1048866c0: std::io::BufRead::read_line (src/io/mod.rs:2176:18)", +"0x1048866c0: ::read_line (src/io/stdio.rs:493:9)", +"0x104886620: std::io::stdio::Stdin::read_line (src/io/stdio.rs:386:9)", +"0x104766b94: zero_copy_deserialize::mamad (zero-copy-deserialize/src/main.rs:20:5)", +"0x10488a528: alloc::alloc::exchange_malloc (alloc/src/alloc.rs:320:11)", +"0x10488a528: alloc::boxed::Box::new (alloc/src/boxed.rs:195:9)", +"0x10488a528: as core::convert::From>::from (alloc/src/boxed.rs:1386:9)", +"0x10488a528: std::sys_common::mutex::MovableMutex::new (src/sys_common/mutex.rs:64:25)", +"0x104889734: std::sync::mutex::Mutex::new (src/sync/mutex.rs:218:20)", +"0x104889734: std::io::stdio::stdin::{{closure}} (src/io/stdio.rs:324:13)", +"0x104889734: std::lazy::SyncOnceCell::get_or_init::{{closure}} (std/src/lazy.rs:281:50)", +"0x104889734: std::lazy::SyncOnceCell::initialize::{{closure}} (std/src/lazy.rs:462:19)", +"0x104889734: std::sync::once::Once::call_once_force::{{closure}} (src/sync/once.rs:334:40)", +"0x10489bd58: ::allocate (alloc/src/alloc.rs:231:9)", +"0x10489bd58: alloc::raw_vec::RawVec::allocate_in (alloc/src/raw_vec.rs:185:45)", +"0x10489bd58: alloc::raw_vec::RawVec::with_capacity_in (alloc/src/raw_vec.rs:132:9)", +"0x10489bd58: alloc::vec::Vec::with_capacity_in (src/vec/mod.rs:613:20)", +"0x10489bd58: ::to_vec (alloc/src/slice.rs:227:25)", +"0x10489bd58: alloc::slice::hack::to_vec (alloc/src/slice.rs:176:9)", +"0x10489bd58: alloc::slice::::to_vec_in (alloc/src/slice.rs:507:9)", +"0x10489bd58: as core::clone::Clone>::clone (src/vec/mod.rs:2485:9)", +"0x10489bd58: ::clone (alloc/src/string.rs:1861:23)", +"0x104766ad4: zero_copy_deserialize::parse (zero-copy-deserialize/src/main.rs:13:15)", +"0x104766bcc: zero_copy_deserialize::mamad (zero-copy-deserialize/src/main.rs:24:5)", +"0x1048897e8: ::allocate (alloc/src/alloc.rs:231:9)", +"0x1048897e8: alloc::raw_vec::RawVec::allocate_in (alloc/src/raw_vec.rs:185:45)", +"0x1048897e8: alloc::raw_vec::RawVec::with_capacity_in (alloc/src/raw_vec.rs:132:9)", +"0x1048897e8: alloc::vec::Vec::with_capacity_in (src/vec/mod.rs:613:20)", +"0x1048897e8: alloc::vec::Vec::with_capacity (src/vec/mod.rs:470:9)", +"0x1048897e8: std::io::buffered::bufwriter::BufWriter::with_capacity (io/buffered/bufwriter.rs:115:33)", +"0x1048897e8: std::io::buffered::linewriter::LineWriter::with_capacity (io/buffered/linewriter.rs:109:29)", +"0x1048897e8: std::io::buffered::linewriter::LineWriter::new (io/buffered/linewriter.rs:89:9)", +"0x1048897e8: std::io::stdio::stdout::{{closure}} (src/io/stdio.rs:609:58)", +"0x1048897e8: std::lazy::SyncOnceCell::get_or_init_pin::{{closure}} (std/src/lazy.rs:375:25)", +"0x1048897e8: std::sync::once::Once::call_once_force::{{closure}} (src/sync/once.rs:334:40)", +"0x104886e20: std::sync::once::Once::call_once_force (src/sync/once.rs:334:9)", +"0x104886e20: std::lazy::SyncOnceCell::get_or_init_pin (std/src/lazy.rs:374:9)", +"0x104886e20: std::io::stdio::stdout (src/io/stdio.rs:608:16)", +"0x104886e20: std::io::stdio::print_to (src/io/stdio.rs:1016:21)", +"0x104886e20: std::io::stdio::_print (src/io/stdio.rs:1029:5)", +"0x104766cc0: zero_copy_deserialize::main (zero-copy-deserialize/src/main.rs:34:5)" +] +} \ No newline at end of file diff --git a/flamegraph.svg b/flamegraph.svg new file mode 100644 index 0000000..bd2a9c0 --- /dev/null +++ b/flamegraph.svg @@ -0,0 +1,414 @@ +Flame Graph Reset ZoomSearch dyld`start (1 samples, 50.00%)dyld`startzero-copy-deserialize`main (1 samples, 50.00%)zero-copy-deserialize`mainzero-copy-deserialize`std::rt::lang_start_internal (1 samples, 50.00%)zero-copy-deserialize`std::rt::lang_start_internalzero-copy-deserialize`std::rt::lang_start::_{{closure}} (1 samples, 50.00%)zero-copy-deserialize`std::rt::lang_start::_{{closure}}zero-copy-deserialize`std::sys_common::backtrace::__rust_begin_short_backtrace (1 samples, 50.00%)zero-copy-deserialize`std::sys_common::backtrace::__rust_begin_short_backtracezero-copy-deserialize`zero_copy_deserialize::main (1 samples, 50.00%)zero-copy-deserialize`zero_copy_deserialize::mainzero-copy-deserialize`std::io::stdio::_print (1 samples, 50.00%)zero-copy-deserialize`std::io::stdio::_printzero-copy-deserialize`std::sync::once::Once::call_inner (1 samples, 50.00%)zero-copy-deserialize`std::sync::once::Once::call_innerzero-copy-deserialize`std::sync::once::Once::call_once_force::_{{closure}} (1 samples, 50.00%)zero-copy-deserialize`std::sync::once::Once::call_once_force::_{{closure}}libsystem_malloc.dylib`_malloc_zone_malloc (1 samples, 50.00%)libsystem_malloc.dylib`_malloc_zone_malloclibsystem_malloc.dylib`szone_malloc_should_clear (1 samples, 50.00%)libsystem_malloc.dylib`szone_malloc_should_clearlibsystem_malloc.dylib`small_malloc_should_clear (1 samples, 50.00%)libsystem_malloc.dylib`small_malloc_should_clearlibsystem_malloc.dylib`mvm_allocate_pages (1 samples, 50.00%)libsystem_malloc.dylib`mvm_allocate_pageslibsystem_kernel.dylib`_kernelrpc_mach_vm_map_trap (1 samples, 50.00%)libsystem_kernel.dylib`_kernelrpc_mach_vm_map_trapall (2 samples, 100%)libsystem_kernel.dylib`__exit (1 samples, 50.00%)libsystem_kernel.dylib`__exit \ No newline at end of file diff --git a/main-expanded.rs b/main-expanded.rs new file mode 100644 index 0000000..9d73013 --- /dev/null +++ b/main-expanded.rs @@ -0,0 +1,54 @@ +#![feature(prelude_import)] +#[prelude_import] +use std::prelude::rust_2021::*; +#[macro_use] +extern crate std; +use std::io; +struct T { + name: String, +} +#[automatically_derived] +#[allow(unused_qualifications)] +impl ::core::fmt::Debug for T { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match *self { + T { + name: ref __self_0_0, + } => { + let debug_trait_builder = &mut ::core::fmt::Formatter::debug_struct(f, "T"); + let _ = + ::core::fmt::DebugStruct::field(debug_trait_builder, "name", &&(*__self_0_0)); + ::core::fmt::DebugStruct::finish(debug_trait_builder) + } + } + } +} +fn parse(s: &String) -> T { + T { name: s.clone() } +} +fn mamad(s: String) -> T { + parse(&s) +} +fn main() { + let mut buffer = String::new(); + let stdin = io::stdin(); + stdin.read_line(&mut buffer).unwrap(); + let t = mamad(buffer); + { + ::std::io::_print(::core::fmt::Arguments::new_v1_formatted( + &["", "\n"], + &[::core::fmt::ArgumentV1::new_debug(&t)], + &[::core::fmt::rt::v1::Argument { + position: 0usize, + format: ::core::fmt::rt::v1::FormatSpec { + fill: ' ', + align: ::core::fmt::rt::v1::Alignment::Unknown, + flags: 4u32, + precision: ::core::fmt::rt::v1::Count::Implied, + width: ::core::fmt::rt::v1::Count::Implied, + }, + }], + unsafe { ::core::fmt::UnsafeArg::new() }, + )); + }; +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..bd4ada5 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,43 @@ +use std::io; + +#[cfg(feature = "dhat-heap")] +#[global_allocator] +static ALLOC: dhat::Alloc = dhat::Alloc; + +struct T { + name: String +} + +fn parse(s: String) -> T { + T { + name: s.clone() + } +} + +fn mamad() -> T { + let mut buff = String::new(); + let stdin = io::stdin(); // We get `Stdin` here. + stdin.read_line(&mut buff).unwrap(); + + //let name = Box::new(s); + //parse(&name) + parse(buff) +} + + +fn main() { + #[cfg(feature = "dhat-heap")] + let _profiler = dhat::Profiler::new_heap(); + + let t = mamad(); + + println!("name: {}", t.name); + + std::thread::sleep(std::time::Duration::from_secs(10)); + + drop(t); + + println!("done"); + + std::thread::sleep(std::time::Duration::from_secs(10)); +} diff --git a/src/test.rs b/src/test.rs new file mode 100644 index 0000000..e69de29