I have been working on a Lite app in ver 4.53 for some while and after an
upgrade to ver 5.21 I noticed a distinct slowdown in page rendering.
I have tracked it back to a snippet that loads a few thousand stash values.
Under ver 4.83 or 4.53 it takes less than a second, while from ver 4.84
onwards it takes just over 3 seconds..
Some test code..
#!/usr/bin/env perl
use utf8;
use Mojolicious::Lite;
use DBI;
my $match = $ARGV[0] || die "No database number\n";
my $dbh = DBI->connect("dbi:SQLite:$match.db", undef, undef,
{sqlite_unicode => 1});
helper db => sub { $dbh };
get '/' => sub {
my $self = shift;
my @rows;
my $sth = $self->db->prepare('SELECT * FROM updates');
$sth->execute;
while (my $t_id = $sth->fetchrow_hashref() ) {
push(@rows, ($$t_id{'id'}, $$t_id{'content'}));
}
while (my $id = shift(@rows)) {
my $content = shift(@rows);
$self->stash($id => $content);
}
$self->render('invalid');
};
app->start;
__DATA__
@@ invalid.html.ep
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>combien.info LiveScore</title>
</head>
<body>
<center><h2>Invalid Data Format...</h2>
<p>
<h3><%= $sponsor %> <%= $g16a %></h3></center>
</body>
</html>
Log output from *morbo tst.pl ls0 *using ver 4.84
[Thu Jul 31 00:42:37 2014] [info] Listening at "http://*:3000".
[Thu Jul 31 00:42:54 2014] [debug] Your secret passphrase needs to be
changed!!!
[Thu Jul 31 00:42:54 2014] [debug] GET "/".
[Thu Jul 31 00:42:54 2014] [debug] Routing to a callback.
[Thu Jul 31 00:42:54 2014] [info] selected * from updates..
[Thu Jul 31 00:42:54 2014] [info] pushed * to @rows..3720
[Thu Jul 31 00:42:57 2014] [info] stashed * from @rows..
[Thu Jul 31 00:42:57 2014] [debug] Rendering template "invalid.html.ep"
from DATA section.
[Thu Jul 31 00:42:57 2014] [debug] 200 OK (3.024671s, 0.331/s).
[Thu Jul 31 00:43:08 2014] [debug] GET "/".
[Thu Jul 31 00:43:08 2014] [debug] Routing to a callback.
[Thu Jul 31 00:43:08 2014] [info] selected * from updates..
[Thu Jul 31 00:43:08 2014] [info] pushed * to @rows..3720
[Thu Jul 31 00:43:11 2014] [info] stashed * from @rows..
[Thu Jul 31 00:43:11 2014] [debug] Rendering cached template
"invalid.html.ep" from DATA section.
[Thu Jul 31 00:43:11 2014] [debug] 200 OK (3.008230s, 0.332/s).
Any ideas anyone?
Peter.
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.