D5550: rust-cpython: bindings for MissingAncestors
gracinet (Georges Racinet)
phabricator at mercurial-scm.org
Mon Jan 14 18:16:19 UTC 2019
gracinet added inline comments.
INLINE COMMENTS
> kevincox wrote in ancestors.rs:170
> This could be a `.collect()` call. Something like:
>
> let bases_vec: Vec<PyObject> = bases_set.into_iter()
> .map(|rev| rev.to_py_object(py).into_object())
> .collect();
Hi @kevincox. I have a general question for these, please correct me if I'm making wrong assumptions.
Given that we know in advance exactly the number of elements required, and that it can be large, doesn't it add overhead to convert everything to collection of iterators? I suppose the `Vec` would have to grow several times, and that's as many calls to `malloc()` inernally. I'm not sure at this point it would be very costly, but in this case where we consume the `Vec` immediately, is there a reason to believe that going the `collect()` way could have their own performance benefits?
Note: this code landed, but I'm about to submit some related refactors, and in this specific case, it's going to be replace I hope very soon with a call to `PySet`, but I'm asking in general.
Cheers,
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5550
To: gracinet, #hg-reviewers
Cc: yuja, durin42, kevincox, mercurial-devel
More information about the Mercurial-devel
mailing list