jplatte / serde_html_form

Rust crate for (de-)serialization of `application/x-www-form-urlencoded` data.
MIT License
23 stars 3 forks source link

Add some simple benchmarks #14

Closed jplatte closed 9 months ago

jplatte commented 9 months ago

… to compare performance with serde_urlencoded.

jplatte commented 9 months ago

Results locally:

Timer precision: 40 ns
upstream_comparison                         fastest       │ slowest       │ median        │ mean          │ samples │ iters
├─ serde_html_form                                        │               │               │               │         │
│  ├─ deserialize_list_duplicate_keys       389.5 ns      │ 5.069 µs      │ 400.5 ns      │ 454.2 ns      │ 100     │ 100
│  ├─ deserialize_list_enum                 423.4 ns      │ 442.2 ns      │ 428.4 ns      │ 427.6 ns      │ 100     │ 1600
│  ├─ deserialize_map                       540.5 ns      │ 5.409 µs      │ 560.5 ns      │ 622.4 ns      │ 100     │ 100
│  ├─ deserialize_map_many_entries          8.295 µs      │ 13.58 µs      │ 8.561 µs      │ 8.642 µs      │ 100     │ 100
│  ├─ deserialize_struct_long_parameters    470.4 ns      │ 538 ns        │ 481.7 ns      │ 484.3 ns      │ 100     │ 800
│  ├─ deserialize_struct_long_parameters_2  766 ns        │ 3.223 µs      │ 806 ns        │ 934.6 ns      │ 100     │ 400
│  ╰─ deserialize_struct_simple             239.6 ns      │ 253.4 ns      │ 243.1 ns      │ 243.6 ns      │ 100     │ 3200
╰─ serde_urlencoded                                       │               │               │               │         │
   ├─ deserialize_list_duplicate_keys       361.4 ns      │ 625.7 ns      │ 371.4 ns      │ 421.9 ns      │ 100     │ 1600
   ├─ deserialize_list_enum                 424 ns        │ 807.3 ns      │ 425.9 ns      │ 462.5 ns      │ 100     │ 1600
   ├─ deserialize_map                       526.7 ns      │ 1.067 µs      │ 536.7 ns      │ 569.7 ns      │ 100     │ 800
   ├─ deserialize_map_many_entries          8.375 µs      │ 17.39 µs      │ 8.551 µs      │ 8.718 µs      │ 100     │ 100
   ├─ deserialize_struct_long_parameters    478 ns        │ 545.5 ns      │ 499.9 ns      │ 499.6 ns      │ 100     │ 800
   ├─ deserialize_struct_long_parameters_2  753.5 ns      │ 774.7 ns      │ 758.5 ns      │ 759.1 ns      │ 100     │ 800
   ╰─ deserialize_struct_simple             239.9 ns      │ 462.9 ns      │ 258.1 ns      │ 262.4 ns      │ 100     │ 3200