Skip to content

Commit

Permalink
made routes without conditions slightly faster
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 20, 2012
1 parent c80c51a commit 84371e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion Changes
Expand Up @@ -11,7 +11,6 @@ This file documents the revision history for Perl extension Mojolicious.
- Improved tests.
- Fixed bug that slowed down Mojolicious::Renderer.
- Fixed small newline capture bug in Mojolicious::Routes::Match.
- Fixed small condition bug.

This comment has been minimized.

Copy link
@judofyr

judofyr Mar 20, 2012

And you unfixed the bug?

This comment has been minimized.

Copy link
@kraih

kraih Mar 20, 2012

Author Member

The fix is now just a side effect of the Mojolicious::Routes/Mojolicious::Routes::Route split. :)


2.62 2012-03-17 00:00:00
- Deprecated Mojolicious::Renderer->default_template_class in favor
Expand Down
11 changes: 6 additions & 5 deletions lib/Mojolicious/Routes/Match.pm
Expand Up @@ -44,11 +44,12 @@ sub match {
}

# Conditions
my $over = $r->over || [];
my $conditions = $self->{conditions} ||= $r->root->conditions;
for (my $i = 0; $i < @$over; $i += 2) {
return unless my $condition = $conditions->{$over->[$i]};
return if !$condition->($r, $c, $captures, $over->[$i + 1]);
if (my $over = $r->over) {
my $conditions = $self->{conditions} ||= $r->root->conditions;
for (my $i = 0; $i < @$over; $i += 2) {
return unless my $condition = $conditions->{$over->[$i]};
return if !$condition->($r, $c, $captures, $over->[$i + 1]);
}
}

# WebSocket
Expand Down

0 comments on commit 84371e5

Please sign in to comment.