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

Python bindings and benchmark #18

Merged
merged 1 commit into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target
*.wasm
tpke-python/py-benches/inputs/
96 changes: 96 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"subproductdomain",
"tpke",
"tpke-wasm",
"tpke-python",
]

[profile.bench]
Expand Down
7 changes: 7 additions & 0 deletions tpke-python/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
__pycache__
*.egg-info
*.so
build/
dist/
docs/_build

52 changes: 52 additions & 0 deletions tpke-python/BENCHMARK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Benchmarks

## Hardware

Benchmarks produced on:

- Intel® Core™ i7-10875H CPU @ 2.30GHz × 16 (single-threaded),
- Version 107.0.5304.110 (Official Build) (64-bit),
- Pop!\_OS 22.04 LTS (64-bit),

### Setup

First, build the WASM target and make inputs for Python benchmarks:

```bash
cd tpke-wasm
wasm-pack build --release --target nodejs # Notice the target
node scripts/make-python-bench-inputs.js
```

Then, build and install the Python package:

```bash
cd tpke-python
pip install -e .
```

### Running

```bash
cd tpke-python
python py-benches/benchmark.py

```

## Results

Using fixed values, such that `shares=num_entities=threshold`.

Rounding to nearest ms.

### Python Results

Filename refers to the number of shares.

```
participant-payloads-8.json: 2 ms
participant-payloads-16.json: 3 ms
participant-payloads-32.json: 6 ms
participant-payloads-64.json: 12 ms
participant-payloads-128.json: 25 ms
```
15 changes: 15 additions & 0 deletions tpke-python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "tpke-python"
authors = ["Piotr Roslaniec <[email protected]>"]
version = "0.1.0"
edition = "2018"

[lib]
crate-type = ["cdylib"]

[dependencies]
pyo3 = "0.16"
group-threshold-cryptography = { path = "../tpke"}

[build-dependencies]
pyo3-build-config = "*"
Loading