[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/02: L::SlidingWindow: Check errors from read manually



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit 627d274ce8d1cc62f623021d0706841ffec12aca
Author: Niels Thykier <niels@thykier.net>
Date:   Wed Feb 26 22:28:00 2014 +0100

    L::SlidingWindow: Check errors from read manually
    
    Avoid using autodie in "readwindow", since the overhead on this path
    accumulates on "very large source packages" (hi chromium-browser).
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 lib/Lintian/SlidingWindow.pm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/Lintian/SlidingWindow.pm b/lib/Lintian/SlidingWindow.pm
index 74925d1..42e88f0 100644
--- a/lib/Lintian/SlidingWindow.pm
+++ b/lib/Lintian/SlidingWindow.pm
@@ -44,8 +44,16 @@ sub new {
 sub readwindow {
     my ($self) = @_;
     my ($window, $queue);
-    unless(read($self->{'_handle'}, $window, $self->{'_blocksize'})) {
-        return;
+    {
+        # This path is too hot for autodie at its current performance
+        # (at the time of writing, that would be autodie/2.23).
+        # - Benchmark chromium-browser/32.0.1700.123-2/source
+        no autodie qw(read);
+        my $res = read($self->{'_handle'}, $window, $self->{'_blocksize'});
+        if (not $res) {
+            die "read failed: $!\n" if not defined($res);
+            return;
+        }
     }
 
     if(defined($self->{'_blocksub'})) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: