use warnings;
use strict;
use Data::Dumper;
+use Time::HiRes;
use Maasha::Common;
use Maasha::Calc;
use Maasha::Filesys;
$step *= 5;
}
- for ( $i = $beg; $i < $end; $i++ )
+ for ( $i = $beg; $i < $end; $i++ ) { # TODO: this loop is slow!
+ last if ( ( $i % $step ) == 0 );
+ }
+
+ while ( $i < $end )
{
- if ( ( $i % $step ) == 0 )
- {
- $txt = "|" . Maasha::Calc::commify( $i );
- $x = sprintf( "%.0f", ( ( $i - $beg ) * $factor ) + 2 );
+ $txt = "|" . Maasha::Calc::commify( $i );
+ $x = sprintf( "%.0f", ( ( $i - $beg ) * $factor ) + 2 );
- if ( $x > 0 and $x + ( $cookie->{ 'RULER_FONT_SIZE' } * length $txt ) < $cookie->{ 'IMG_WIDTH' } )
- {
- push @ruler, {
- type => 'text',
- txt => $txt,
- font_size => $cookie->{ 'RULER_FONT_SIZE' },
- color => $cookie->{ 'RULER_COLOR' },
- x1 => $x,
- y1 => $cookie->{ 'TRACK_OFFSET' },
- };
- }
+ if ( $x > 0 and $x + ( $cookie->{ 'RULER_FONT_SIZE' } * length $txt ) < $cookie->{ 'IMG_WIDTH' } )
+ {
+ push @ruler, {
+ type => 'text',
+ txt => $txt,
+ font_size => $cookie->{ 'RULER_FONT_SIZE' },
+ color => $cookie->{ 'RULER_COLOR' },
+ x1 => $x,
+ y1 => $cookie->{ 'TRACK_OFFSET' },
+ };
}
+
+ $i += $step;
}
$cookie->{ 'TRACK_OFFSET' } += $cookie->{ 'TRACK_SPACE' };
return wantarray ? @{ $features } : $features;
}
+
+
+my $t0 = Time::HiRes::gettimeofday();
+my $t1 = Time::HiRes::gettimeofday(); print STDERR "Time: " . ( $t1 - $t0 ) . "\n";