Changeset 11064
- Timestamp:
- 03/11/10 03:32:39 (2 years ago)
- Location:
- trunk/Padre
- Files:
-
- 5 edited
-
Changes (modified) (1 diff)
-
lib/Padre.pm (modified) (2 diffs)
-
lib/Padre/SlaveDriver.pm (modified) (4 diffs)
-
lib/Padre/Startup.pm (modified) (3 diffs)
-
lib/Padre/Wx/App.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/Changes
r11058 r11064 3 3 4 4 0.59 To Be Released 5 - Don't crash open file list dialog on unsaved files or without files6 (SEWI)5 - Don't crash open file list dialog on unsaved files or without 6 files (SEWI) 7 7 - Added a small survey for new Padre installation (SEWI) 8 8 - Resolved the clash between threads and SQLite by temporarily 9 9 disconnecting from SQLite during a thread spawn (ADAMK) 10 - Move the slave driver spawn into Padre::Startup, so that 11 we get much much smaller thread spawn memory penalty from the 12 interpreter copy (ADAMK) 10 - Slave master quick-spawning in Padre::Startup, so that 11 we get smaller thread spawn memory penalty from the 12 interpreter copy. On Win32 the per-thread cost drops from 13 34.1meg to 20meg with a reduction in total memory use for a 14 typical user of about 20% (ADAMK) 13 15 14 16 0.58 2010.03.08 -
trunk/Padre/lib/Padre.pm
r11029 r11064 149 149 # Create the main window 150 150 require Padre::Wx::App; 151 $self->{wx} = Padre::Wx::App-> new($self);151 $self->{wx} = Padre::Wx::App->create($self); 152 152 153 153 # Create the task manager … … 158 158 159 159 # Create the action queue 160 $self->{actionqueue} = Padre::Action::Queue->new ();160 $self->{actionqueue} = Padre::Action::Queue->new; 161 161 162 162 # Startup completed, let go of the database -
trunk/Padre/lib/Padre/SlaveDriver.pm
r11056 r11064 80 80 81 81 # Wx must be loaded before this code fires 82 require Wx; 82 83 require Wx::Event; 83 84 $TASK_DONE_EVENT = Wx::NewEventType() unless defined $TASK_DONE_EVENT; … … 123 124 124 125 sub spawn { 125 my $self = shift;126 my $ task_manager = shift;126 my $self = shift; 127 my $manager = shift; 127 128 128 129 require Storable; 129 130 $self->{cmd_queue}->enqueue( 130 Storable::freeze( [ $ task_manager->task_queue ] )131 Storable::freeze( [ $manager->task_queue ] ) 131 132 ); 132 133 … … 194 195 @_ = (); # Hack to avoid "Scalars leaked" 195 196 196 require Storable; 197 require Padre::TaskManager; 198 199 # Set the thread-specific main-window pointer 200 my $wx = Padre->ide->wx; 201 202 # warn threads->tid() . " -- Hi, I'm a thread."; 203 204 while ( my $frozen_task = $queue->dequeue ) { 205 206 # warn threads->tid() . " -- got task."; 197 # warn threads->tid . " -- Hi, I'm a thread."; 198 199 # Hold a pointer to the global application root 200 require Padre::Wx::App; 201 my $wx = Padre::Wx::App->new; 202 203 while ( my $frozen = $queue->dequeue ) { 204 205 # warn threads->tid . " -- got task."; 207 206 208 207 # warn("THREAD TERMINATING"), return 1 if not ref($task) and $task eq 'STOP'; 209 return 1 if not ref($frozen_task) and $frozen_task eq 'STOP'; 210 211 my $task = Padre::Task->deserialize( \$frozen_task ); 208 return 1 if not ref($frozen) and $frozen eq 'STOP'; 209 210 require Padre::Task; 211 my $task = Padre::Task->deserialize( \$frozen ); 212 212 $task->{__thread_id} = threads->tid; 213 213 214 my $ thread_start_event= Wx::PlThreadEvent->new(214 my $before = Wx::PlThreadEvent->new( 215 215 -1, 216 216 $TASK_START_EVENT, 217 217 $task->{__thread_id} . ";" . ref($task), 218 218 ); 219 Wx::PostEvent( $wx, $ thread_start_event);219 Wx::PostEvent( $wx, $before ); 220 220 221 221 # RUN … … 223 223 224 224 # FREEZE THE PROCESS AND PASS IT BACK 225 undef $frozen _task;226 $task->serialize( \$frozen _task);227 228 my $ thread_done_event= Wx::PlThreadEvent->new(225 undef $frozen; 226 $task->serialize( \$frozen ); 227 228 my $after = Wx::PlThreadEvent->new( 229 229 -1, 230 230 $TASK_DONE_EVENT, 231 $frozen _task,231 $frozen, 232 232 ); 233 Wx::PostEvent( $wx, $ thread_done_event);234 235 # warn threads->tid (). " -- done with task.";233 Wx::PostEvent( $wx, $after ); 234 235 # warn threads->tid . " -- done with task."; 236 236 } 237 237 } 238 238 239 239 sub _slave_driver_loop { 240 my ( $in queue, $outqueue) = @_;241 @_ = (); # hack to avoid "Scalars leaked"242 243 while ( my $args = $in queue->dequeue ) { # args is frozen [$main, $queue]240 my ( $in, $out ) = @_; 241 @_ = (); # Hack to avoid "Scalars leaked" 242 243 while ( my $args = $in->dequeue ) { # args is frozen [$main, $queue] 244 244 last if $args eq 'STOP'; 245 my $ task_queue= Padre::SlaveDriver->new->task_queue;246 my $worker _thread = threads->create( \&_worker_loop, $task_queue );247 $out queue->enqueue( $worker_thread->tid );245 my $queue = Padre::SlaveDriver->new->task_queue; 246 my $worker = threads->create( \&_worker_loop, $queue ); 247 $out->enqueue( $worker->tid ); 248 248 } 249 249 -
trunk/Padre/lib/Padre/Startup.pm
r11059 r11064 99 99 } 100 100 foreach my $file (@ARGV) { 101 require File::Spec; 101 102 my $path = File::Spec->rel2abs($file); 102 103 $socket->print("open $path\n"); … … 106 107 return 0; 107 108 } 109 } 110 111 # NOTE: Replace the following with if ( 0 ) will disable the 112 # slave master quick-spawn optimisation. 113 114 # If we are going to use threading, spawn off the slave 115 # driver as early as we possibly can so we reduce the amount of 116 # wasted memory copying to a minimum. 117 if ( $setting{threads} ) { 118 require Padre::SlaveDriver; 119 Padre::SlaveDriver->new; 108 120 } 109 121 … … 162 174 } 163 175 164 # If we are going to use threading, spawn off the slave165 # driver as early as we possibly can so we reduce the amount of166 # wasted memory copying to a minimum.167 if ( $setting{threads} and 0 ) {168 require Padre::SlaveDriver;169 Padre::SlaveDriver->new;170 }171 172 176 return 1; 173 177 } -
trunk/Padre/lib/Padre/Wx/App.pm
r10997 r11064 31 31 use strict; 32 32 use warnings; 33 use Carp (); 34 use Params::Util qw{ _INSTANCE }; 33 use Carp (); 35 34 use Padre::Wx (); 36 35 … … 45 44 # Constructor and Accessors 46 45 47 sub new { 48 my $class = shift; 49 my $ide = shift; 50 unless ( _INSTANCE( $ide, 'Padre' ) ) { 51 Carp::croak("Did not provide the ide object to Padre::App->new"); 46 sub create { 47 my $self = shift->new; 48 49 # Check IDE param 50 my $ide = shift; 51 require Params::Util; 52 unless ( Params::Util::_INSTANCE($ide, 'Padre') ) { 53 Carp::croak("Did not provide the ide object to Padre::App->create"); 52 54 } 53 54 # Create the Wx object55 my $self = $class->SUPER::new;56 55 57 56 # Save a link back to the parent ide
Note: See TracChangeset
for help on using the changeset viewer.
