Skip to content

Commit

Permalink
add python bindings and benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec committed Nov 18, 2022
1 parent c0c2c9e commit 0091ae1
Show file tree
Hide file tree
Showing 24 changed files with 1,244 additions and 89 deletions.
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

0 comments on commit 0091ae1

Please sign in to comment.