use MCE::Simple -strict, max_workers => 16; use MCE::Semaphore; use Time::HiRes 'time'; my $start = time; my $sem = MCE::Semaphore->new(8); mce_foreach_s ( 1 .. 1_000_000 ) { $sem->down; $sem->up; } printf "%0.3f seconds\n", time - $start;