MCPcopy Create free account
hub / github.com/argumentcomputer/ix / to_bytes

Method to_bytes

crates/kernel/src/profile.rs:215–239  ·  view source on GitHub ↗

Serialize to the `.ixprof` binary format.

(&self)

Source from the content-addressed store, hash-verified

213 &self.delta_col[lo..hi]
214 }
215
216 /// Build the reverse delta adjacency: for each producer block, the sorted set
217 /// of consumer blocks that unfold it. This is the natural form for the
218 /// partition hypergraph, where `net(p) = {p} ∪ consumers_of(p)`.
219 pub fn consumers_csr(&self) -> (Vec<usize>, Vec<u32>) {
220 let n = self.num_blocks();
221 let mut counts = vec![0usize; n + 1];
222 for &p in &self.delta_col {
223 counts[p as usize + 1] += 1;
224 }
225 for i in 0..n {
226 counts[i + 1] += counts[i];
227 }
228 let row = counts.clone();
229 let mut col = vec![0u32; self.delta_col.len()];
230 let mut cursor = counts;
231 for c in 0..n as u32 {
232 for &p in self.producers(c) {
233 let slot = cursor[p as usize];
234 col[slot] = c;
235 cursor[p as usize] += 1;
236 }
237 }
238 (row, col)
239 }
240
241 /// Total heartbeats across all blocks.
242 pub fn total_heartbeats(&self) -> u128 {

Callers 2

roundtrip_serializationFunction · 0.45

Calls 2

as_bytesMethod · 0.80
lenMethod · 0.45

Tested by 2

roundtrip_serializationFunction · 0.36