Changeset 2447a1ba09d4f7cff926232db18cfe3ac3c96ea6
- Timestamp:
- 10/27/09 20:52:15 (4 weeks ago)
- Author:
- Nelson Elhage <nelhage@mit.edu>
- git-author:
- Nelson Elhage <nelhage@mit.edu> / 2009-10-26T21:39:46Z-0400
- Parents:
- 369707ed232a584a6b9f06c3e2c84ce4eb9f281e
- Children:
- 0b21230c60038729b397adb87a85bb71f24a661c
- git-committer:
- Nelson Elhage <nelhage@mit.edu> / 2009-10-27T20:52:15Z-0400
- Message:
-
Performance improvement in fixup.
Turn the single loop into two nested loops with part of fill_forward
inlined, and use aliases to speed up access to the loop variable.
This is about a 10% speedup for large message-list walking operations.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r791e70f
|
r2447a1b
|
|
| 8 | 8 | sub view {return shift->{view}} |
| 9 | 9 | sub index {return shift->{index}} |
| | 10 | |
| | 11 | our ($i, $v); |
| 10 | 12 | |
| 11 | 13 | sub new { |
| … |
… |
|
| 127 | 129 | my $self = shift; |
| 128 | 130 | |
| 129 | | # This check is redudant, in that this is exactly the test that |
| 130 | | # the below code would end up doing anyways. However, profiling |
| 131 | | # reveals that fast-tracking the common case like this is a huge |
| 132 | | # performance win, since this is probably /the/ the hottest piece |
| 133 | | # of code path when walking views. |
| 134 | | return 0 if $self->{index} < $self->range->next_fwd |
| 135 | | && $self->{view}->message($self->{index}); |
| | 131 | local *i = \$self->{index}; |
| | 132 | local *v = \$self->{view}; |
| 136 | 133 | |
| 137 | | return 1 if $self->fill_forward; |
| 138 | | |
| 139 | | while(!$self->{view}->message($self->{index})) { |
| 140 | | $self->{index}++; |
| | 134 | do { |
| | 135 | while($i < $self->range->next_fwd) { |
| | 136 | return 0 if $v->message($i); |
| | 137 | $i++; |
| | 138 | } |
| 141 | 139 | return 1 if $self->fill_forward; |
| 142 | | } |
| | 140 | } while(!$v->message($i)); |
| 143 | 141 | return 0; |
| 144 | 142 | } |