Optimising tex-buffer/iter?



I have the following code
($prog in this case is customisable ffmpeg commands)


else {
$pid=open($file, "-|","$prog $inp1 $opts $newfile 2>&1" )
or die "Failed running perl subprocess\n";
$pid1=$pid+1; # not relvant
push (@pids,$pid1); # to this issue
}

our $tag=  Glib::IO->add_watch ( fileno($file), ['in', 'hup'], sub {
         my ($fileno, $condition,$tag) = @_;
         if ($condition eq 'hup') {

                 close $file;
                 return 0;  # uninstall
         }


         my $line ;
         sysread $file, $line, 128;
my $end_mark=$buffer->create_mark('end',$buffer->get_end_iter,0);
$buffer->signal_connect(insert_text=>sub{
$textview->scroll_to_mark($end_mark,0.0,1,0.0,1.0);});
         $buffer->insert($buffer->get_end_iter,$line);

         return 1;

 }

);

It seems to be getting bogged down somewher and I am not quite sure
where, although I suspect it is sysread (using read is far worse)

Ths same code used to have negligible overhead, though that could be
because I was doing vcd's not DVD's

Any one any ideas on optimisation or other functions than sysread,
which may be more efficient?

This is tested on FC6 , with gtk-perl
perl-Gtk2-1.140-1.fc6 (RPM)



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