|
-
May 14th, 2012, 08:03 PM
#1
Embedding Python
Is there an easy way to embed python in C/C++?
I'm using visual studio 2010, and the performance of the BigInteger library is really slow compared to how python handles large integers. Is there a way to use python just for the mathematical operations, and C/C++ for the rest?
Last edited by SamstaUK; May 15th, 2012 at 05:02 AM.
-
May 14th, 2012, 09:00 PM
#2
Re: Embedding Python
 Originally Posted by SamstaUK
I'm using visual studio 2010, and the performance of the BigInteger library is really slow compared to how python handles large integers.
Maybe next time, if rewriting in Python is not applicable, you should just try another C or C++ bignum library instead, e.g., GMP.
-
May 15th, 2012, 04:59 AM
#3
Re: Embedding Python
How does GMP compare to python in terms of speed? Python can calculate 2 to the power of 100,000 in 1 second, would GMP have the same or better performance?
-
May 15th, 2012, 05:24 AM
#4
Re: Embedding Python
You would need to test to find out, since it depends on how large are the numbers and what are your compile options. I would venture a guess that the larger the numbers involved, the better GMP will be compared to Python (and I suspect that for sufficiently small integers, Python will win hands down because the implementation would then switch to use native integers whereas GMP isn't designed for that).
-
May 15th, 2012, 10:27 AM
#5
Re: Embedding Python
 Originally Posted by SamstaUK
Is there an easy way to embed python in C/C++?
Boost Python
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|