Skip to content

Commit

Permalink
slightly faster warmup process
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 17, 2014
1 parent fdfe08a commit aec9029
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/Mojolicious/Renderer.pm
Expand Up @@ -242,18 +242,15 @@ sub _warmup {

my ($index, $templates) = @$self{qw(index templates)} = ({}, {});

# Classes for DATA templates
for my $class (reverse @{$self->classes}) {
$index->{$_} = $class for keys %{$LOADER->data($class)};
}

# Handlers for templates
s/\.(\w+)$// and push @{$templates->{$_}}, $1
for map { sort @{Mojo::Home->new($_)->list_files} } @{$self->paths};

# Handlers for DATA templates
s/\.(\w+)$// and push @{$templates->{$_}}, $1
for map { sort keys %{$LOADER->data($_)} } @{$self->classes};
# Handlers and classes for DATA templates
for my $class (reverse @{$self->classes}) {
$index->{$_} = $class for my @keys = sort keys %{$LOADER->data($class)};
s/\.(\w+)$// and unshift @{$templates->{$_}}, $1 for reverse @keys;
}
}

1;
Expand Down

0 comments on commit aec9029

Please sign in to comment.