pros and cons of C++ vs Python - opinions please

Jason Gerard DeRose jderose at novacut.com
Wed Jul 18 08:10:00 PDT 2012


On Wed, Jul 18, 2012 at 8:33 AM, Chuck Crisler <ccrisler at mutualink.net> wrote:
> I will soon be developing a gstreamer replacement for a VLC application. I
> have been a C++ programmer for over 20 years, working with gstreamer for the
> last 2. I could almost build the code (OK, I would have to research the
> plugins) in my sleep. But there is this new thing (not really, but somewhat)
> called Python that works with gstreamer. The application that I will develop
> is stand-alone in the sense that it is invoked from a different application.
> What are the relative merits of using Python vs. C++? Currently, no one in
> our shop does Python so this would be the first app. I can't say if it would
> ever be the only app. Thank you for different opinions. Chuck Crisler

Personally, I'd go with Python, but that's my bias. There are really
only 2 disadvantages to using Python, in my opinion:

1) Memory overhead - if you need your app's memory footprint to be as
small as possible (say for mobile/embedded), Python isn't the right
choice.

2) Startup time - Python will probably add at least 100-150ms to a
warm start. That said, I feel it's often easier to make a fast
starting Python app because you can iterate more quickly on solving
what (likely) is actually making your app start slowly (needless
synchronous IO, other silly stuff)

I'd also say that the harder the problem domain is, the more I'd
recommended Python. However, building a video player with GStreamer is
very easy... there are extremely high-level building blocks. So a
video player is a place I'd at least consider using C (or in your case
C++), despite my heavy Python bias.

I just happen to have same bare-bones Python video player examples
handy, so you can see what it takes.

This is GStreamer 0.10 (static Python bindings):

http://bazaar.launchpad.net/~jderose/+junk/gst-examples/view/head:/video-player-0.10

This is a port of the same to GStreamer 1.0 (PyGI):

http://bazaar.launchpad.net/~jderose/+junk/gst-examples/view/head:/video-player-1.0

Of course, as they say, "use what you know", so factor that in too.

Have fun!
______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>


More information about the gstreamer-devel mailing list