This is an archive of the discontinued Mercurial Phabricator instance.

rust-filepatterns: call new Rust implementations from Python
ClosedPublic

Authored by Alphare on Apr 18 2019, 8:11 AM.

Details

Summary

This change adds the import to the rust-cpython bindings and uses
them when appropriate.

A wrapper function has been defined in the case of _regex to
keep this patch simple.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Alphare created this revision.Apr 18 2019, 8:11 AM
durin42 accepted this revision.May 15 2019, 2:13 PM
durin42 added a subscriber: durin42.

Are there any performance implications of this yet?

This revision is now accepted and ready to land.May 15 2019, 2:13 PM

Are there any performance implications of this yet?

We (read Octobus) are planning very soon to start benchmarking Rust vs non-Rust Mercurial, so I'll hopefully have an answer within a few weeks.

Though If I had to take a guess, I'd say these patches as well as the few next ones will be detrimental to performance in the short-term. This is because of some limitations in the rust-cpython bindings (some of which are more difficult to fix than others), the inherent overhead of doing ffi, Python idoms awkward for Rust, etc..
The C code I'm re-implemented in some modules is very heavily optimized, but the current approach is to build enough critical mass to have the Rust bits of code interacting as little as possible with Python and then start optimizing/parallelizing.

Alphare updated this revision to Diff 15143.May 16 2019, 11:21 AM
This revision was automatically updated to reflect the committed changes.