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

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Chuck Crisler-2
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
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

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

Loren Rogers
Greetings Chuck,
I think the obvious difference is that C++ compiles to native and with
python you'd need to install some levels for language interpretation.
And I'm a proponent for sticking with what you know.
/Loren

On Wed, Jul 18, 2012 at 10:33 AM, Chuck Crisler <[hidden email]> 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
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>



--
"Some men see things as they are and say why. I dream things that
never were and say why not?" - GBS
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

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

Jason Gerard DeRose-2
In reply to this post by Chuck Crisler-2
On Wed, Jul 18, 2012 at 8:33 AM, Chuck Crisler <[hidden email]> 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
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

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

Brian Duffy
In reply to this post by Chuck Crisler-2
Need more info on your architecture. Generally speaking though, I agree with previous comment ... stick to what you know unless it is really unsuited to what you are trying to accomplish. How will you need to distribute your application? Also, Vala has some nice bindings to gstreamer as well, if that appeals to you.

On Wed, Jul 18, 2012 at 10:33 AM, Chuck Crisler <[hidden email]> 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
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




--
Duff

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

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

Tim-Philipp Müller-2
In reply to this post by Chuck Crisler-2
On Wed, 2012-07-18 at 10:33 -0400, Chuck Crisler 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.

It depends a bit on the C++ "flavour" you're after as well.

If you are happy to just use the GStreamer C API and build your
application in C++, that would be my recommendation.

Otherwise there are GStreamer-Qt and GStreamermm (Gtk) C++ bindings for
GStreamer, but the problem with these is that there is not a huge user
base for them and that there are no major applications (yet) that use
them, so they've had considerably less exposure in real-world
applications than, say, the python-gst bindings.

If you don't have other reasons to switch to python, I wouldn't do it
just for this (but if you do, you should be aware of the upcoming
gst-0.10/python-gst to gst-0.11/1.0/py-gi transition).

Cheers
 -Tim

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

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

saepia
I would suggest to take a look on Vala - it has syntax close to C# but
compiles down to native code, and is designed to work well with
GObject-based libraries, such as GStreamer. You will gain both nice
syntax and efficiency.

m.

2012/7/18 Tim-Philipp Müller <[hidden email]>:

> On Wed, 2012-07-18 at 10:33 -0400, Chuck Crisler 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.
>
> It depends a bit on the C++ "flavour" you're after as well.
>
> If you are happy to just use the GStreamer C API and build your
> application in C++, that would be my recommendation.
>
> Otherwise there are GStreamer-Qt and GStreamermm (Gtk) C++ bindings for
> GStreamer, but the problem with these is that there is not a huge user
> base for them and that there are no major applications (yet) that use
> them, so they've had considerably less exposure in real-world
> applications than, say, the python-gst bindings.
>
> If you don't have other reasons to switch to python, I wouldn't do it
> just for this (but if you do, you should be aware of the upcoming
> gst-0.10/python-gst to gst-0.11/1.0/py-gi transition).
>
> Cheers
>  -Tim
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

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

Tony Houghton
In reply to this post by Tim-Philipp Müller-2
On Wed, 18 Jul 2012 16:27:21 +0100
Tim-Philipp Müller <[hidden email]> wrote:

> If you don't have other reasons to switch to python, I wouldn't do it
> just for this (but if you do, you should be aware of the upcoming
> gst-0.10/python-gst to gst-0.11/1.0/py-gi transition).

That's a good point, which I was ging to raise. python-gi is still quite
difficult to use because it doesn't document itself very well, although
improvements are on the horizon
<https://bugzilla.gnome.org/show_bug.cgi?id=679804>. But I didn't get a
reply to my question here about how to read a list of GstStructures from
a field of a parent GstStructure in python-gi/gst-0.11, so maybe it isn't
possible yet, or if it is nobody knows how! :-/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

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

Erick Pérez Castellanos-2
In reply to this post by Chuck Crisler-2
I agree with mostly with "stick to what you know unless is really
necesary to use anything else". But, and this is just my own story.
Recently I started building an app using gstreamer for multimedia
handling and I started using python, cause it seemed easy, I've been
programmed with python before so I'm not new to the language.
The main problem I encountered was the bindings, you're adding a layer
of complexity just by using python wrappers over the C API.

What I recommend is to build your app using C++ and use C API of
gstreamer which is documented, tested and easy to debug.

As said in the thread there's C++ bindings, but I'd stick to the C API
as much as I could.

Regards

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel