D2057: translate base85.c into rust code

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Tue Feb 6 05:34:57 EST 2018


durin42 added a subscriber: indygreg.
durin42 added a comment.


  I'd be curious to see what @indygreg has to say about this, maybe wait on his input before doing any work in response to my feedback?
  
  I do wonder if we should have at least three crates:
  
  1. hgcli
  2. libmercurial
  3. hgcext
  
  The first one would be the command-line entry point, the last could use the cpython API, and libmercurial would be "pure rust" and open the door to eventually having a libhg or something that exports C functions and would be suitable for cffi and linking into other binaries?

INLINE COMMENTS

> base85.rs:22
> +
> +pub fn b85encode(py: Python, text: &str, pad: i32) -> PyResult<PyObject> {
> +    let text = text.as_bytes();

I think I'd like to separate things a bit more and have a Python-free module, and then a glue module that we can use to call into the pure Rust. Part of the reason is that in my perfect world we won't use the cpython crate for speedups so they can be used from pypy as well. Separating them at least makes it easier to have an extern "C" version of the method that can be used from cffi instead of only through the CPython API.

(Not sure what opinions others have. It's likely that I'll attempt this approach in the near future as part of a continued attempt to speed up `hg diff`.)

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2057

To: Ivzhh, #hg-reviewers
Cc: indygreg, durin42, kevincox, mercurial-devel


More information about the Mercurial-devel mailing list