Closed dj8yfo closed 11 months ago
group base new
----- ---- ---
ser_account/borsh::object_length(obj).unwrap()/idx=0; size=191 1.00 0.4±0.01ns 415.3 GB/sec 1.00 0.4±0.01ns 415.3 GB/sec
ser_account/borsh::object_length(obj).unwrap()/idx=1; size=168 1.00 0.4±0.01ns 363.5 GB/sec 1.00 0.4±0.01ns 363.5 GB/sec
ser_account/borsh::object_length(obj).unwrap()/idx=2; size=90 1.00 0.4±0.01ns 199.3 GB/sec 1.00 0.4±0.01ns 199.3 GB/sec
ser_account/borsh::to_vec(obj).unwrap().len()/idx=0; size=191 1.00 19.1±0.33ns 9.3 GB/sec 1.00 19.1±0.33ns 9.3 GB/sec
ser_account/borsh::to_vec(obj).unwrap().len()/idx=1; size=168 1.00 18.2±0.23ns 8.6 GB/sec 1.00 18.2±0.23ns 8.6 GB/sec
ser_account/borsh::to_vec(obj).unwrap().len()/idx=2; size=90 1.00 19.2±1.26ns 4.4 GB/sec 1.00 19.2±1.26ns 4.4 GB/sec
resolves #23
in scope of work on nearcore update it was noticed that pattern
borsh_obj.try_to_vec().unwrap().len()
was used quite a few times, thus it may be a slight optimization to replace this pattern with computing length without memory allocation: