Giter VIP home page Giter VIP logo

differt's Issues

Add MRSV and check it in CI

Currently, we do not provide a minimum Rust supported version. We should provide such a version and add CI tests to check that it can compile with that version.

Bug - `all_paths*` methods from `differt.rt.graph` do not allow `from_` to be a keyword argument

E.g., DiGraph.all_paths(from_=0, ...) does not work as the text signature (from_) differs from the true signature (from). This is an issue because from cannot be used in Python.

Possible solutions:

  • Create a wrapper in Python that maps keyword-arguments to positional arguments.
  • Make from_ and others explicitly positional-only parameters.
  • Rename from to from_ inside Rust code (at least in the function signatures).

Idea: optimizing wheels with PGO

This feature suggestion is highly inspired from maciejhirsz/logos#374, from a repository I maintain.

Actually, the idea would be to follow what pydantic-core does, see https://github.com/pydantic/pydantic-core/blob/44621f1dee5160c737a0749d21e0b2118fa99705/.github/workflows/ci.yml#L464-L557, to generate more performant code.

The setup for DiffeRT should be as follows:

  1. Install the necessary LLVM tools:
rustup component add llvm-tools-preview
  1. Compile code so that it can generate profiles:
RUSTFLAGS='-Cprofile-generate=/tmp/pgo-data/profdata' maturin build --release --out pgo-wheel
  1. Install the library from new wheels:
pdm run python -m pip install differt --no-index --no-deps --find-links pgo-wheel --force-reinstall
  1. Actually generate profiles by running code that uses wheels:
pdm run pytest --benchmark-only tests
  1. Merge profiles. The actual path to llvm-profdata may change, see https://doc.rust-lang.org/rustc/profile-guided-optimization.html.
~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata merge -o /tmp/pgo-data/merged.profdata /tmp/pgo-data/profdata
  1. Generate optimized build:
RUSTFLAGS='-Cprofile-use=/tmp/pgo-data/merged.profdata' maturin build --release --out dist

The only question I have is whether this is actually useful (did run a benchmark after, but not improvement noticed). I might need to write better benchmarks (that target actually what I want to optimize).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.