astropy / halotools

Python package for studying large scale structure, cosmology, and galaxy evolution using N-body simulations and halo models
http://halotools.rtfd.org
BSD 3-Clause "New" or "Revised" License
104 stars 65 forks source link

cython extensions are compiled to c++ source code. #828

Open rainwoodman opened 7 years ago

rainwoodman commented 7 years ago

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

aphearin commented 7 years ago

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?

duncandc commented 7 years ago

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.

rainwoodman commented 7 years ago

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

On Tue, Nov 14, 2017 at 9:18 AM, Duncan Campbell notifications@github.com 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 .

aphearin commented 7 years ago

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.

rainwoodman commented 7 years ago

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.