Its hard to test Tk against C, but with Gtk2 it can be done. Below are the same program, one in Gtk2-c and one Gtk2-perl. Here are the top output when run:
# for c version zentara 15 0 14368 7012 5400 S 0.0 0.7 0:00 .07 . +/basic-window-c #for the Perl version zentara 18 0 21700 12m 9056 S 0.0 1.3 0:00 12 + ./basic-window.pl
As you can see Perl uses way more memory; 12m versus 7k for c. The question becomes, with systems with 1 and 2 gigs of ram being common, can you afford the extra ram usage, in exchange for the ease of writing it in Perl? For me, the answer is yes. C can take hours, where Perl is done in minutes.
/* compile test-c.c with gcc -o test-c test-c.c `pkg-config --cflags --libs gtk+-2.0` */ #include <gtk/gtk.h> void destroy(GtkWidget *widget, gpointer data) { gtk_main_quit(); } int main(int argc, char *argv[]) { GtkWidget *window; GtkWidget *button; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK(des +troy), 1); gtk_container_set_border_width(GTK_CONTAINER (window), 10); button = gtk_button_new_with_label ("Some Button"); gtk_container_add(GTK_CONTAINER(window), button); gtk_widget_show(button); gtk_widget_show (window); gtk_main (); return 0; }
#!/usr/bin/perl use warnings; use strict; use Gtk2 '-init'; my $window = Gtk2::Window->new; my $button = Gtk2::Button->new('Some Button'); my $vbox = Gtk2::VBox->new(); $window->set( border_width => 15 ); $window->add($button); $window->signal_connect('destroy', sub { Gtk2->main_quit }); $window->show_all(); Gtk2->main;

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

In reply to Re^3: Tk Win32 memory overhead by zentara
in thread Tk Win32 memory overhead by jbenezech

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.