Hi tybalt89,
Wow! Your new entry runs faster than C++. Also, memory consumption is less than 500 MB ;-)
$ perl createblinker.pl 500000 -900000 100 >x.tmp 2>y.tmp
$ g++ -o tbench1 -std=c++11 -Wall -O3 tbench1.cpp
$ time ./tbench1 x.tmp 2
cell count at start = 1500000
run benchmark for 2 ticks
cell count at end = 1500000
time taken 4 secs
real 0m5.240s mem 139 MB
user 0m5.149s
sys 0m0.085s
$ time /opt/perl-5.26.0/bin/perl -I. tbench1.pl x.tmp 2
cell count at start = 1500000
run benchmark for 2 ticks
cell count at end = 1500000
time taken: 1 secs
real 0m3.482s mem 492 MB
user 0m3.242s
sys 0m0.233s
Micro-optimization may be a subjective matter. At this level, one may want to for 2%.
I've replaced 3 multiplications ( $w * 2 ) with ( $w << 1 ).
( $sum |= substr $all, $_ ) =~ tr/1357/2468/ for
1, 2, $w, $w + 2, ($w << 1), ($w << 1) + 1, ($w << 1) + 2; # other 7
+ neighbors
$ time /opt/perl-5.26.0/bin/perl -I. tbench1.pl x.tmp 2
cell count at start = 1500000
run benchmark for 2 ticks
cell count at end = 1500000
time taken: 1 secs
real 0m3.420s mem 492 MB
user 0m3.203s
sys 0m0.205s
Regards, Mario