halotools icon indicating copy to clipboard operation
halotools copied to clipboard

cython extensions are compiled to c++ source code.

Open rainwoodman opened this issue 8 years ago • 5 comments

It appears that halotools doesn't really need c++. If that's the case, using C makes life of downstream packaging a lot easier.

rainwoodman avatar Nov 14 '17 05:11 rainwoodman

I'd love to get rid of the c++ compilation @rainwoodman - The only place where any cpp-specific feature is used is in the pairwise distance engines: pairwise_distance_3d_engine, pairwise_distance_xy_z_engine and conditional_pairwise_distances. In particular, these functions use libcpp.vector. I have not looked into how much the algorithm would need to change if this dependence were dropped - @duncandc could you comment to that effect?

aphearin avatar Nov 14 '17 17:11 aphearin

I agree that it would be ideal to get rid of the C++ dependency. Let me take a look at those functions to see if we can get around using the libcpp.vector library without any significant penalty.

duncandc avatar Nov 14 '17 17:11 duncandc

Sorry I didn't realize it is using libcpp.vector.

On Tue, Nov 14, 2017 at 9:18 AM, Duncan Campbell [email protected] wrote:

I agree that it would be ideal to get rid of the C++ dependency. Let me take a look at those functions to see if we can get around using the libcpp.vector library without any significant penalty.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/astropy/halotools/issues/828#issuecomment-344331525, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIbTFllVINt_2uFwX-PFRnT9uz5wMemks5s2ct6gaJpZM4Qczog .

rainwoodman avatar Nov 14 '17 19:11 rainwoodman

Those three functions are the only ones using libcpp.vector in the entire repo @rainwoodman - if you know of common workarounds for this, I would happily use those instead. These three functions do not need to be ultra-high performance.

aphearin avatar Nov 14 '17 19:11 aphearin

If there is a reasonably sized upper bound, can you simply allocate according to the bound and update a size variable?

incremental growth of around 1.5x with realloc() is not very hard too, you only need to keep size and maxsize.

rainwoodman avatar Nov 14 '17 20:11 rainwoodman