From 9739d9f2073735858f84d83113f4a3ee09b6c67f Mon Sep 17 00:00:00 2001 From: Kenneth Loeffler Date: Mon, 28 Oct 2024 16:23:28 +0000 Subject: [PATCH] Add rbx_binary 10,000 parts benchmarks (#461) --- rbx_binary/bench-files/parts-10000.rbxm | Bin 0 -> 13406 bytes rbx_binary/benches/deserializer.rs | 13 ++++++++++++- rbx_binary/benches/serializer.rs | 19 ++++++++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 rbx_binary/bench-files/parts-10000.rbxm diff --git a/rbx_binary/bench-files/parts-10000.rbxm b/rbx_binary/bench-files/parts-10000.rbxm new file mode 100644 index 0000000000000000000000000000000000000000..302791a18154c11233e8c54544fadf01e1faf3a9 GIT binary patch literal 13406 zcmeHOO>7%Q6ka=So94f*1hiGXNrO}gAw{ShdWaCtk5N$LY;8B9fdiBExL$R$W9`n; z28q8T5*#8FB&13pP>&orQA9!uRSz7HdPL&F9U~+z9L#&0-Sq}L>DYC&nUIlY*B;N# z&NuJ9neV+BPugtRWVgmXtPl2`=~I-Xq9`XWz{OAVv&GD_@cF#|y>==ApH4!ay;U_0 z-QXFQvsam6aVG_(+;-_)u24J;pPz<|sn(0vqmZ-AEKys*CNN>eyKuj9+xx226Zi`@ zqY;}cBNw1%J&yE=niPI>T1#Tm@(UUc(kNt1wG((f1v$gHZ7jQ-It6MQ#5CTf-T>ee zD*S#9D?+Lb;dKD=G^vth!!)=-oiQxL)VeypV1||ri#pM#l3w*@A>i2N$O=s~q=D^@ zLU9^0rrI!G2O$@jYwI-QIF!$o&SEK~1lGs5dida8LzVG_RwUP*5ZMeAj`@mI@4;f! zf{dkCm`zJbaml7Ncy0^+k8pp(*Ol4;wzhjE@o0{qwr*|*RR|2=2!aALRHlf2 z1B`&IWK!=6tKzsSKCFTrT~fg&1?#4@1SV9F4S=u8}v!Z)|XfY5}FA55mnJq!ZZAWWrs*Q;*g$XCR`vBl|A5zUTCgeujAbIBW zlte4iIatwu`v=9N_>>IU!gLl^BRV2ZjP_tP5}fP~tL^a!ywg}svY;B{0nZER%QUg3 znQ0m&n(T-_v}TXc>J^vTt6grh$XvbBS({5>CF_@bQwf)zC=(ys=fq%-HRZ{g|Kjm_ z=I}y=l-SMAj_sUI5Nq;l5G0 zzc5d@x5v``=w&;B@bTdZS8y&?8y?O>K(y@7#eW`0?t=R_0is0$dq);83@R_f22yEE zqIl9Z!18h6BzrtH1;D&*DExqXeZ7Z%m7u~jRr^fyMi3eHc?jJ79t7?}hd?vlVtk=o zhHbpV=v~wB{SONw(Yw|Qah{e&Z(tse9wC*AM#%DvFH)1i*`?K?eLlU# zGN&Ghmqr%3H$eeD4ftoc?fjq9O~T>812H;cAgs;~|9k`1Ht#z!8)$sU^6_xkfJ9Eq zedu%E2T_Nk0g7@QQLw7SvDoi-#Uve**Z?@qp*|2%+&p4Ug@A;ZiPh6u4<>Zq5YKCY z%Jrej;Ze*6o`XRpiZ-#FDzT}huS(=y`~~v(C7=>vyy=if2&%cX)gnBi_3^bbvsbc2 z=giKNo86B)3J%;_XG`_BFu~-4DF?W)q8x$jR7f?x6RjOW>4V_c&%S~Ffk=>bI1nox z`apOxj_=6Yn)+TFy}T$~S5SSH)E9-D99Q3Oqb?|wU>~|$Ej+xPD_#X{2;$ER`0tjO ty0ku#Yv=T&I(xgjLn7GPy7+%5M!nsO#B6Q`Y;B7n<9%{s>t97L{R^szpK1UA literal 0 HcmV?d00001 diff --git a/rbx_binary/benches/deserializer.rs b/rbx_binary/benches/deserializer.rs index c86462bd1..428bac769 100644 --- a/rbx_binary/benches/deserializer.rs +++ b/rbx_binary/benches/deserializer.rs @@ -30,6 +30,16 @@ pub fn de_modulescripts_100_lines_100(c: &mut Criterion) { }); } +pub fn de_parts_10000(c: &mut Criterion) { + static BUFFER: &[u8] = include_bytes!("../bench-files/parts-10000.rbxm"); + + c.bench_function("Deserialize 10,000 Parts", |b| { + b.iter(|| { + deserialize_bench(BUFFER); + }); + }); +} + #[inline(always)] fn deserialize_bench(buffer: &[u8]) { rbx_binary::from_reader(buffer).unwrap(); @@ -39,6 +49,7 @@ criterion_group!( deserializer, de_folders_100, de_deep_folders_100, - de_modulescripts_100_lines_100 + de_modulescripts_100_lines_100, + de_parts_10000 ); criterion_main!(deserializer); diff --git a/rbx_binary/benches/serializer.rs b/rbx_binary/benches/serializer.rs index f89f5a736..367517fd8 100644 --- a/rbx_binary/benches/serializer.rs +++ b/rbx_binary/benches/serializer.rs @@ -27,5 +27,22 @@ pub fn ser_folders_100(c: &mut Criterion) { }); } -criterion_group!(serializer, ser_folders_100); +pub fn ser_parts_10000(c: &mut Criterion) { + static BUFFER: &[u8] = include_bytes!("../bench-files/parts-10000.rbxm"); + let tree = rbx_binary::from_reader(BUFFER).unwrap(); + let root_ref = tree.root_ref(); + + let mut buffer = Vec::new(); + rbx_binary::to_writer(&mut buffer, &tree, &[root_ref]).unwrap(); + buffer.clear(); + + c.bench_function("Serialize 10,000 Parts", |b| { + b.iter(|| { + rbx_binary::to_writer(&mut buffer, &tree, &[root_ref]).unwrap(); + buffer.clear(); + }) + }); +} + +criterion_group!(serializer, ser_folders_100, ser_parts_10000); criterion_main!(serializer);