Skip to content

Improve compatibility with other messagepack implementations, macro/functions for binary, no nightly #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

computermouth
Copy link

Howdy,

your library here is great, but I noticed a couple things when using it.

  1. it doesn't use a top-level array for arrays or objects with derive (and thus these don't really work with other libraries/tools)
  2. unit struct serialization is different from other implementations
  3. Vec was always BIN rather than ARRAY, I put in an attribute to opt-in in derive and added a binary_unpack_iter
  4. removed nightly features

Overall, I'm not sure you're going to want these changes. It makes the library much slower, but personally I'm much more interested in compatibility with other libraries/tools, and also not using the nightly toolchain.

I figured I'd bubble this up and see if you wanted any of these changes. (This also includes @tehmatt PR #16 )

If there's no interest in upstreaming, I will probably push up a fork of this to crates.io in a few weeks

@LockedThread
Copy link

@vlopes11

@computermouth computermouth force-pushed the byoung/more-standardized branch from 9fd4b38 to 9074f28 Compare May 14, 2025 15:33
@computermouth
Copy link
Author

I've rebased on your recent fixes, if you happen to want these changes, but again they decrease performance significantly. Here are the benchmarks:

pack/msgpacker 1        time:   [95.189 µs 95.864 µs 96.622 µs]
                        change: [+14971% +15209% +15412%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 4 outliers among 100 measurements (4.00%)
  4 (4.00%) high mild
pack/rmps 1             time:   [136.03 µs 136.69 µs 137.50 µs]
                        change: [+0.4761% +1.1670% +1.8183%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 5 outliers among 100 measurements (5.00%)
  5 (5.00%) high mild
pack/msgpacker 10       time:   [627.37 µs 628.18 µs 629.14 µs]
                        change: [+11254% +11573% +11806%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 19 outliers among 100 measurements (19.00%)
  10 (10.00%) high mild
  9 (9.00%) high severe
pack/rmps 10            time:   [858.60 µs 862.87 µs 867.89 µs]
                        change: [-0.8093% +0.4609% +1.6781%] (p = 0.48 > 0.05)
                        No change in performance detected.
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild
pack/msgpacker 100      time:   [6.1718 ms 6.2080 ms 6.2498 ms]
                        change: [+3299.2% +3505.5% +3679.4%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) high mild
  1 (1.00%) high severe
pack/rmps 100           time:   [8.2939 ms 8.3450 ms 8.4005 ms]
                        change: [+0.9786% +1.7842% +2.5981%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 5 outliers among 100 measurements (5.00%)
  3 (3.00%) high mild
  2 (2.00%) high severe
Benchmarking pack/msgpacker 1000: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 7.4s, or reduce sample count to 60.
pack/msgpacker 1000     time:   [72.612 ms 72.863 ms 73.129 ms]
                        change: [+541.41% +544.66% +547.89%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 16 outliers among 100 measurements (16.00%)
  14 (14.00%) high mild
  2 (2.00%) high severe
Benchmarking pack/rmps 1000: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 9.3s, or reduce sample count to 50.
pack/rmps 1000          time:   [92.361 ms 92.821 ms 93.423 ms]
                        change: [-0.8039% -0.2655% +0.3980%] (p = 0.44 > 0.05)
                        No change in performance detected.
Found 18 outliers among 100 measurements (18.00%)
  4 (4.00%) high mild
  14 (14.00%) high severe

unpack/msgpacker 1      time:   [107.27 µs 107.55 µs 107.90 µs]
                        change: [+12306% +12552% +12775%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 11 outliers among 100 measurements (11.00%)
  4 (4.00%) high mild
  7 (7.00%) high severe
unpack/rmps 1           time:   [186.26 µs 186.94 µs 187.74 µs]
                        change: [-4.4453% -3.6499% -2.9320%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  1 (1.00%) high mild
  10 (10.00%) high severe
unpack/msgpacker 10     time:   [689.62 µs 692.25 µs 695.66 µs]
                        change: [+8776.8% +8816.4% +8857.8%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 9 outliers among 100 measurements (9.00%)
  3 (3.00%) high mild
  6 (6.00%) high severe
Benchmarking unpack/rmps 10: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.8s, enable flat sampling, or reduce sample count to 60.
unpack/rmps 10          time:   [1.1419 ms 1.1474 ms 1.1546 ms]
                        change: [-6.1971% -4.8638% -3.6109%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  3 (3.00%) high mild
  4 (4.00%) high severe
unpack/msgpacker 100    time:   [6.6399 ms 6.6524 ms 6.6663 ms]
                        change: [+3306.5% +3383.0% +3457.2%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 9 outliers among 100 measurements (9.00%)
  7 (7.00%) high mild
  2 (2.00%) high severe
unpack/rmps 100         time:   [10.843 ms 10.875 ms 10.912 ms]
                        change: [-6.2510% -5.0295% -4.0139%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  4 (4.00%) high mild
  6 (6.00%) high severe
Benchmarking unpack/msgpacker 1000: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 7.7s, or reduce sample count to 60.
unpack/msgpacker 1000   time:   [76.484 ms 76.616 ms 76.771 ms]
                        change: [+563.72% +571.04% +578.09%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 8 outliers among 100 measurements (8.00%)
  7 (7.00%) high mild
  1 (1.00%) high severe
Benchmarking unpack/rmps 1000: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 11.7s, or reduce sample count to 40.
unpack/rmps 1000        time:   [116.74 ms 117.03 ms 117.37 ms]
                        change: [-4.8942% -3.8337% -2.8899%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  4 (4.00%) high mild
  4 (4.00%) high severe

Quite a bit slower, but still faster than rmps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants