Skip to content
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

Better serialization of binary values and singletons #844

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

Conversation

iliailia
Copy link
Collaborator

@iliailia iliailia commented Dec 19, 2024

Instead of sending single values as VecRingT, we serialize them as individual elements. This is especially beneficial when doing bitwise comparisons, where sending a single bit required 5 bytes of serialized data. This change reduces it to 2. For u64, the size is reduced from 20 to 10 bytes.
In addition, this PR replaces bincode with bitcode, which is about 15% more compact for the NetworkValue enum. The total gain is about 37%.

Communication cost per party to insert 1 vector into a database of size 1 (i.e., one call to eval_distance and one call to less_than) is given below.

Before:

Stats for party Identity("alice"):
Bytes sent: 1389
Bytes received: 1389
Stats for party Identity("bob"):
Bytes sent: 1389
Bytes received: 1437
Stats for party Identity("charlie"):
Bytes sent: 1417
Bytes received: 1369

After:

Stats for party Identity("alice"):
Bytes sent: 885
Bytes received: 885
Stats for party Identity("bob"):
Bytes sent: 885
Bytes received: 907
Stats for party Identity("charlie"):
Bytes sent: 896
Bytes received: 874

bitcode is slower than bincode, which is reflected in a 5-25% increase in running time for both insertion and search.

gr_ready_made_hnsw/gr-big-hnsw-insertions/1
                        time:   [2.3032 ms 2.3137 ms 2.3299 ms]
                        change: [+6.1174% +8.1775% +10.549%] (p = 0.00 < 0.05)
gr_ready_made_hnsw/gr-big-hnsw-searches/1
                        time:   [3.3832 ms 3.4097 ms 3.4656 ms]
                        change: [+7.6982% +9.7017% +11.805%] (p = 0.00 < 0.05)
gr_ready_made_hnsw/gr-big-hnsw-insertions/10
                        time:   [85.330 ms 86.775 ms 88.262 ms]
                        change: [+2.7516% +4.7590% +6.7136%] (p = 0.00 < 0.05)
gr_ready_made_hnsw/gr-big-hnsw-searches/10
                        time:   [53.284 ms 53.762 ms 54.214 ms]
                        change: [+6.1638% +10.074% +13.611%] (p = 0.00 < 0.05)
gr_ready_made_hnsw/gr-big-hnsw-insertions/100
                        time:   [1.2600 s 1.2681 s 1.2769 s]
                        change: [+1.9064% +4.8861% +7.8922%] (p = 0.01 < 0.05)
gr_ready_made_hnsw/gr-big-hnsw-searches/100
                        time:   [775.21 ms 786.06 ms 797.46 ms]
                        change: [+10.597% +15.231% +19.069%] (p = 0.00 < 0.05)
gr_ready_made_hnsw/gr-big-hnsw-insertions/1000
                        time:   [3.4237 s 3.4414 s 3.4590 s]
                        change: [+6.5509% +8.5298% +10.339%] (p = 0.00 < 0.05)
gr_ready_made_hnsw/gr-big-hnsw-searches/1000
                        time:   [2.0689 s 2.1586 s 2.2907 s]
                        change: [+10.130% +15.345% +23.125%] (p = 0.00 < 0.05)
gr_ready_made_hnsw/gr-big-hnsw-insertions/10000
                        time:   [6.9597 s 7.1282 s 7.3122 s]
                        change: [+14.125% +16.964% +20.189%] (p = 0.00 < 0.05)
gr_ready_made_hnsw/gr-big-hnsw-searches/10000
                        time:   [3.7279 s 3.8948 s 4.0742 s]
                        change: [+13.594% +19.064% +25.207%] (p = 0.00 < 0.05)
gr_ready_made_hnsw/gr-big-hnsw-insertions/100000
                        time:   [9.0077 s 9.4853 s 9.9697 s]
                        change: [+19.589% +25.218% +31.718%] (p = 0.00 < 0.05)
gr_ready_made_hnsw/gr-big-hnsw-searches/100000
                        time:   [4.6592 s 4.8944 s 5.1631 s]
                        change: [+8.8328% +14.471% +20.709%] (p = 0.00 < 0.05)
                        Performance has regressed.

@iliailia iliailia requested review from bgillesp and dkales December 19, 2024 16:32
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.

1 participant