()
| 169 | // ============================================================================ |
| 170 | |
| 171 | fn main() -> parcode::Result<()> { |
| 172 | println!("\n=== PARCODE V3 COMPREHENSIVE ARCHITECTURAL AUDIT ===\n"); |
| 173 | |
| 174 | ALLOCATOR.reset(); |
| 175 | let world_data = generate_world(); |
| 176 | |
| 177 | // ------------------------------------------------------------------------ |
| 178 | // TEST 1: WRITING (Serialization) |
| 179 | // ------------------------------------------------------------------------ |
| 180 | println!("\n[TEST 1: WRITING TO DISK]"); |
| 181 | |
| 182 | // Parcode |
| 183 | ALLOCATOR.reset(); |
| 184 | let t_start = Instant::now(); |
| 185 | let mut parcode_buffer = Vec::new(); |
| 186 | Parcode::write(&mut parcode_buffer, &world_data)?; |
| 187 | let t_par_write = t_start.elapsed(); |
| 188 | let mem_par_write = ALLOCATOR.peak(); |
| 189 | let size_par = parcode_buffer.len(); |
| 190 | let parcode_buffer = Arc::new(parcode_buffer); |
| 191 | |
| 192 | // Bincode |
| 193 | ALLOCATOR.reset(); |
| 194 | let t_start = Instant::now(); |
| 195 | let mut bincode_buffer = Vec::new(); |
| 196 | bincode::serde::encode_into_std_write( |
| 197 | &world_data, |
| 198 | &mut bincode_buffer, |
| 199 | bincode::config::standard(), |
| 200 | ) |
| 201 | .expect("Bincode serialization failed"); |
| 202 | let t_bin_write = t_start.elapsed(); |
| 203 | let mem_bin_write = ALLOCATOR.peak(); |
| 204 | let size_bin = bincode_buffer.len(); |
| 205 | |
| 206 | print_metric("Write Time", t_par_write, t_bin_write); |
| 207 | print_ram("Write RAM", mem_par_write, mem_bin_write); |
| 208 | print_size("Disk Size", size_par, size_bin); |
| 209 | |
| 210 | // ------------------------------------------------------------------------ |
| 211 | // TEST 2: Full Read (Read all data from buffer) |
| 212 | // ------------------------------------------------------------------------ |
| 213 | println!("\n[TEST 2: Full Read]"); |
| 214 | |
| 215 | // Parcode: deserialize EVERYTHING optionally |
| 216 | ALLOCATOR.reset(); |
| 217 | let t_start = Instant::now(); |
| 218 | let _full_world: WorldState = Parcode::load_bytes(parcode_buffer.clone())?; |
| 219 | let t_par_open = t_start.elapsed(); |
| 220 | let mem_par_open = ALLOCATOR.peak(); |
| 221 | |
| 222 | // Bincode: Must deserialize EVERYTHING to be usable |
| 223 | ALLOCATOR.reset(); |
| 224 | let t_start = Instant::now(); |
| 225 | let _full_world: WorldState = bincode::serde::decode_from_std_read( |
| 226 | &mut Cursor::new(&bincode_buffer), |
| 227 | bincode::config::standard(), |
| 228 | ) |
nothing calls this directly
no test coverage detected