Steffen Mueller wrote:
> Hi Adam,
> 
> not much time to reply. Not much time to get involved soon. Quick reply.
> 
> Adam Kennedy wrote:
>> If anyone wants to investigate some kind of custom Wx loader, it might
>> let us save as much as 5-10meg per thread, which would mean a 15-30meg
>> memory reduction in Padre overall, and double or triple the thread
>> spawn time (which might get the threads fast enough to remove the need
>> to pre-spawn a bunch of threads, removing another third of a second
>> from the startup time.
>>
>> It's a job there if anyone would like it.
> 
> Once somebody figured out a general idea how to do that, I'm confident 
> Mattia would be willing to accept patches or ideas. He's been remarkably 
> open to my suggestion of splitting out Wx::Event.

   The delay-load branch of wxPerl contains a Wx::Threading module that 
loads the bare minimum required to send an event from a thread to the 
main loop.  Test script below.

Regards,
Mattia

#!/usr/bin/perl -w

use strict;
use threads;
use threads::shared;
use Wx::Threading;
# use Wx;

my $TEST_DONE_EVENT : shared;

sub send_thread_event {
     sleep 3;
     my $threvent = new Wx::PlThreadEvent( -1, $TEST_DONE_EVENT, 123 );
     Wx::PostEvent( Wx::wxTheApp, $threvent );
}

my $thread;

BEGIN {
     $TEST_DONE_EVENT = Wx::NewEventType;
     $thread = threads->create( \&send_thread_event );
}

use Wx;

my $app = Wx::SimpleApp->new;

Wx::Event::EVT_COMMAND( $app, -1, $TEST_DONE_EVENT,
                         sub { print "Hi there!\n"; sleep 50 } );

$app->MainLoop;
_______________________________________________
Padre-dev mailing list
Padre-dev@perlide.org
http://mail.perlide.org/mailman/listinfo/padre-dev

Reply via email to