perl5 における strftime の速度にかんするベンチ
use strict; use warnings; use Benchmark qw/cmpthese/; use POSIX (); use Time::Piece; cmpthese( -1 => { 'tp' => sub { Time::Piece->new->strftime('[%Y-%m-%d %T]') }, 'posix' => sub { POSIX::strftime('[%Y-%m-%d %T]', localtime()); }, } );
Rate tp posix tp 29805/s -- -15% posix 35223/s 18% --
結論:どっちでもあんまかわらん。