mirror of
https://github.com/dkogan/feedgnuplot.git
synced 2025-05-05 22:11:12 +08:00
gnuplot driver more efficient. while,shift -> firstidx,splice
Ignore-this: 78741ffed855a5122e14486000af4154 darcs-hash:20090811181852-0cb85-ca6a28ee8151f7c8671c0d69dce8f29ed481fe4f.gz
This commit is contained in:
parent
78b6147d86
commit
0dab1a0ec0
@ -3,6 +3,7 @@ use strict;
|
||||
use Getopt::Long;
|
||||
use Time::HiRes qw( usleep );
|
||||
use IO::Handle;
|
||||
use List::MoreUtils qw( first_index );
|
||||
use Data::Dumper;
|
||||
|
||||
autoflush STDOUT 1;
|
||||
@ -215,9 +216,11 @@ sub cutOld
|
||||
foreach (@curves)
|
||||
{
|
||||
my $xy = $_->{"data"};
|
||||
while(@$xy && $xy->[0][0] < $oldestx)
|
||||
|
||||
if( @$xy )
|
||||
{
|
||||
shift @$xy;
|
||||
my $firstInWindow = first_index {$_->[0] >= $oldestx} @$xy;
|
||||
splice( @$xy, 0, $firstInWindow ) unless $firstInWindow == -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user