Re: [gtk-list] Re: Drag and Drop, try 1





On Fri, 13 Jun 1997, Martynas Kunigelis wrote:

> P.S. I don't want to start a flamewar, but has anybody asked why did
>      the autors choose C for gtk? I mean my heart hurts when I see
>      all the "C++ emulation" stuff. IMHO well written C++ code can be
>      as small/fast as C, and there's one BIG advantage that I see.
>      Here it is: I bet that every gtk_*_new() call returns a pointer
>      to malloc()'ed GtkWidget, right? Widget structures are pretty
>      small, right? The heap fragmentation gets pretty big, also the
>      overhead of having a lot of small heap chunks appears. Damn, 
>      testgtk eats 2M on my Linux system, where any of the Qt demos
>      eat about 1M (I'm not subtracting the shared lib size, I know
>      several apps would share it, but I'm taking a standalone app).
>      And with C++ you can easily create widgets on the stack or agregate
>      them into other classes. Allright, just don't start a flamewar,
>      that's just a simple $0.0002.

For what it's worth I think the fact they did it in C is one of it's best
features.. and like others have said, you can always add wrappers for C++.


Something interesting to think about :)


imain@slow:~$ cat hello_world.c 
#include <stdio.h>

int main(void)
{
        printf("hello world\n");
        return(0);
}


imain@slow:~$ gcc hello_world.c -o hello-c

imain@slow:~$ g++ hello_world.c -o hello-cc

imain@slow:~$ time hello-c
hello world

real    0m0.126s
user    0m0.010s
sys     0m0.010s

imain@slow:~$ time hello-cc
hello world

real    0m0.671s
user    0m0.040s
sys     0m0.060s


This is linux 2.0.30 with all the latest  - gcc version 2.7.2.1.. I'm sure
it's the linktime for the C++ version that kills it..

Ian



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]