Skip to content

Commit

Permalink
Merge pull request #110 from egraphs-good/benchmark
Browse files Browse the repository at this point in the history
Add profiling
  • Loading branch information
saulshanabrook authored Feb 2, 2024
2 parents ff934ab + b297b19 commit c6f79bc
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 238 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
python-version: ${{ matrix.py }}
cache: "pip"
- run: pip install -e .[test]
- run: pytest
- run: pytest --benchmark-disable -vvv
mypy:
runs-on: ubuntu-latest
steps:
Expand All @@ -50,6 +50,21 @@ jobs:
- run: pip install -e .[test] mypy pre-commit
- run: pre-commit run --hook-stage manual mypy
- run: pre-commit run --hook-stage manual stubtest
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.71.1
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: "pip"
- run: pip install -e .[test]
- uses: CodSpeedHQ/action@v2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest -vvv -n auto
docs:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `egglog` Python wrapper

[![Documentation Status](https://readthedocs.org/projects/egglog-python/badge/?version=latest)](https://egglog-python.readthedocs.io/en/latest/?badge=latest) [![Test](https://github.com/egraphs-good/egglog-python/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/egraphs-good/egglog-python/actions/workflows/CI.yml) [![PyPi Package](https://img.shields.io/pypi/v/egglog.svg)](https://pypi.org/project/egglog/) [![License](https://img.shields.io/pypi/l/egglog.svg)](https://pypi.org/project/egglog/) [![Python Versions](https://img.shields.io/pypi/pyversions/egglog.svg)](https://pypi.org/project/egglog/) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![Documentation Status](https://readthedocs.org/projects/egglog-python/badge/?version=latest)](https://egglog-python.readthedocs.io/en/latest/?badge=latest) [![Test](https://github.com/egraphs-good/egglog-python/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/egraphs-good/egglog-python/actions/workflows/CI.yml) [![PyPi Package](https://img.shields.io/pypi/v/egglog.svg)](https://pypi.org/project/egglog/) [![License](https://img.shields.io/pypi/l/egglog.svg)](https://pypi.org/project/egglog/) [![Python Versions](https://img.shields.io/pypi/pyversions/egglog.svg)](https://pypi.org/project/egglog/) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit) [![CodSpeed Badge](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://codspeed.io/egraphs-good/egglog-python)

`egglog` is a Python package that provides bindings to the Rust library [`egglog`](https://github.com/egraphs-good/egglog/),
allowing you to use e-graphs in Python for optimization, symbolic computation, and analysis.
Expand Down
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ dependencies = ["typing-extensions", "black", "graphviz"]
array = ["scikit-learn", "array_api_compat", "numba==0.59.0rc1", "llvmlite==0.42.0rc1"]
dev = ["pre-commit", "ruff", "mypy", "anywidget[dev]", "egglog[docs,test]"]

test = ["pytest", "mypy", "syrupy", "egglog[array]"]
test = [
"pytest",
"mypy",
"syrupy",
"egglog[array]",
"pytest-codspeed",
"pytest-benchmark",
"pytest-xdist",
]

docs = [
"pydata-sphinx-theme",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def __fn(X, y):
_32 = _17 * _31
_33 = np.linalg.svd(_32, full_matrices=False)
_34 = _33[1] > np.array(0.0001)
_35 = np.sum(_34)
_36 = _35.astype(np.dtype(np.int32))
_35 = _34.astype(np.dtype(np.int32))
_36 = np.sum(_35)
_37 = _33[2][:_36, :] / _29
_38 = _37.T / _33[1][:_36]
_39 = np.array(150) * _7
Expand All @@ -57,8 +57,8 @@ def __fn(X, y):
_45 = np.linalg.svd(_44, full_matrices=False)
_46 = np.array(0.0001) * _45[1][0]
_47 = _45[1] > _46
_48 = np.sum(_47)
_49 = _48.astype(np.dtype(np.int32))
_48 = _47.astype(np.dtype(np.int32))
_49 = np.sum(_48)
_50 = _38 @ _45[2].T[:, :_49]
_51 = _16 @ _50
return _51[:, :2]
Loading

0 comments on commit c6f79bc

Please sign in to comment.