in reply to Re^2: Tk Win32 memory overhead
in thread Tk Win32 memory overhead
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.# 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
/* 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;
|
|---|