#!/usr/bin/env perl use strict; use warnings; use Data::Dump; use Time::HiRes qw(time); # use feature qw(say); my $start = time; my @queue; my @line; # ratio 1.25 - i guess 160 pixel # my $width = 20; # my $height = 8; # my $qsize = 4; # same ratio - i guess 20 MP my $width = 1280 * 4; my $height = 1024 * 4; my $qsize = 32; for my $x ( 0 .. $width - 1 ) { for my $y ( 0 .. $height - 1 ) { my $coords = [ $x, $y ]; push @line, $coords; if ( scalar @line == $width ) { push @queue, [@line]; @line = (); # audacious actions start here if ( scalar @queue == $qsize ) { # dd \@queue; @queue = (); } } } } printf "Took %.3f seconds\n", time - $start; __END__ karls-mac-mini:monks karl$ ./queue.pl Took 13.531 seconds