beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**
https://github.com/beyondgrep/ack3/
Other
1.48k stars 138 forks source link

Inline calls to print_line_if_context #638

Closed petdance closed 5 years ago

petdance commented 7 years ago

In the main loop, if the line isn't a match, we do this:

            else {
                chomp; # XXX Proper newline handling?
                print_line_if_context( $filename, $_, $., '-' );
            }   

If we're not doing context (the most common case), then the chomp is unnecessary and the print_line_if_context is unnecessary.

Let's look at inlining that code, since we're not going to be making any more functionality changes in ack2, and keep this in mind in ack3.

petdance commented 7 years ago

In my basic testing, it sped things up about 4%.

petdance commented 5 years ago

Can't inline this.