开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: Python API vs C/C++ API advantage?


 

Specific?benchmarks are probably not useful here. C/C++ are in general "faster" than python, all things equal, but it's not that simple.?

Working with the IB api is mostly I/O-bound, meaning performance is more a function not blocking the rest of your program while waiting to transfer data over the network. You can do this in Python (with async/await) while maintaining a lot of the benefits of working in python.

It's also worth keeping in mind that performance-sensitive parts of python programs often implemented in native code, especially in the language?itself* and popular numerical/analytics libraries, so a lot of computationally-expensive code is implemented in C (or fortran) anyway.? Finally, writing high-performance code requires particular expertise and is more nuanced?than just number crunching, and has some serious trade offs in terms of complexity, reuse, and safety.

So the guidance is typically just to work with what you're more productive in and optimize only where you are impacted by performance problems you actually have. Working in Python won't paint you in a corner here.


On Thu, Feb 4, 2021 at 10:39 AM <bruceb444@...> wrote:
Hi,

Has anyone benchmarked speed of making requests and receiving data (the full cycle) with C/C++ VS Python?

Does it make a difference to go with either or in speed? (Excluding after the fact calculations which I am thinking with high probability that C wins).

Please post your numbers if you have gauges this.

Thanks,

Join [email protected] to automatically receive all group messages.