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

[lintian] 01/01: html_reports: Share data more between tag instances



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

nthykier pushed a commit to branch master
in repository lintian.

commit 534d169365e57aa99ed0ff1a624c051f6f24b4e2
Author: Niels Thykier <niels@thykier.net>
Date:   Fri Jan 15 21:53:36 2016 +0000

    html_reports: Share data more between tag instances
    
    Baseline "max res" memory for html_reports dropped from 652.5M to
    565.1M (~15%).
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 debian/changelog                    |  2 ++
 reporting/html_reports              | 21 +++++++++++++--------
 reporting/templates/maintainer.tmpl |  8 ++++----
 reporting/templates/tag.tmpl        |  4 ++--
 4 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 5f6e0b4..c79565f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -43,6 +43,8 @@ lintian (2.5.40) UNRELEASED; urgency=medium
       script omit packages on maintainer's pages.  Thanks to Charles
       Plessy for the report and to Dr. Tobias Quathamer for finding
       the condition for triggering the bug.  (Closes: #797178)
+    + [NT] Share more data for a ~15% memory reduction on a an old
+      dataset.
 
  -- Niels Thykier <niels@thykier.net>  Sun, 27 Dec 2015 09:43:24 +0000
 
diff --git a/reporting/html_reports b/reporting/html_reports
index efc0c95..e5e8665 100755
--- a/reporting/html_reports
+++ b/reporting/html_reports
@@ -195,10 +195,11 @@ my (%statistics, %tag_statistics);
 #                            version   => '0.15~20061120-1',
 #                            area      => 'main',
 #                            type      => 'source',
+#                            anchor    => 'gnubg_0.15~20061120-1',
+#                            xref      => 'rra@debian.org.html#gnubg_0.15~20061120-1'
 #             },
 #             tag_info  => $tag_info,  # an instance of Lintian::Tag::Info
 #             extra     => 'gnubg-data'
-#             xref      => 'rra@debian.org.html#gnubg_0.15~20061120-1'
 #           } ] } }
 #
 # and then stored under the key 'Russ Allbery <rra@debian.org>'
@@ -811,8 +812,15 @@ sub parse_lintian_log {
             $statistics{maintainers}++ unless defined $by_maint{$maintainer};
 
             $last_info = $info = {
+                # Tag instance specific data
+
                 # split_tags ensures that $code is a single upper case letter
                 code         => $code,
+                tag_info     => $tag_info,
+                # extra is unsafe in general, but we already quote it above.
+                extra        => $extra,
+
+                # Shareable data
                 pkg_info     => {
                     package      => $package,
                     version      => $version,
@@ -820,14 +828,11 @@ sub parse_lintian_log {
                     # HTML-safe keywords in the start of the loop.,
                     type         => $type,
                     area         => html_quote($area),
+                    # should be safe
+                    anchor       => $anchor,
+                    xref         => maintainer_url($maintainer). "#${anchor}",
+                    'state_data' => $state_data,
                 },
-                tag_info     => $tag_info,
-                # extra is unsafe in general, but we already quote it above.
-                extra        => $extra,
-                # should be safe
-                anchor       => $anchor,
-                xref         => maintainer_url($maintainer). "#${anchor}",
-                'state_data' => $state_data,
             };
             $last_pi = $info->{pkg_info};
             if (!$by_maint{$maintainer}{$source}{$source_version}) {
diff --git a/reporting/templates/maintainer.tmpl b/reporting/templates/maintainer.tmpl
index 5c3a846..bccc912 100644
--- a/reporting/templates/maintainer.tmpl
+++ b/reporting/templates/maintainer.tmpl
@@ -36,14 +36,14 @@
                 # Full report, so include the package
                 @interesting = sort by_version keys %$versions;
                 @interesting = map {
-                    [$_, $versions->{$_}[0]{anchor}]
+                    [$_, $versions->{$_}[0]{pkg_info}{anchor}]
                 } @interesting;
             } else {
                 for my $version (sort by_version keys %$versions) {
                     my $tags = $versions->{$version};
                     for my $tag (@$tags) {
                         if (($tag->{code} eq 'E') or ($tag->{code} eq 'W')) {
-                            push(@interesting, [$version, $tag->{anchor}]);
+                            push(@interesting, [$version, $tag->{pkg_info}{anchor}]);
                             last;
                         }
                     }
@@ -110,12 +110,12 @@
                 my $area = ($pkg_info->{area} eq 'main') ? '' : "; $pkg_info->{area}";
                 $firstarea = $pkg_info->{area} unless $firstarea;
                 if ($first) {
-                    my $state = $info->{'state_data'};
+                    my $state = $pkg_info->{'state_data'};
                     my $status = 'up-to-date';
                     my $last_processed_by = $state->{'last-processed-by'} // 'N/A';
                     $status = '<i>outdated</i>' if (exists($state->{'out-of-date'}));
                     $OUT .= qq(  <div class="source-header">\n);
-                    $OUT .= qq(   <h2 id="$info->{anchor}">);
+                    $OUT .= qq(   <h2 id="$pkg_info->{anchor}">);
                     $OUT .= "$source ($version$area)";
                     $OUT .= " [Uploader]" if $upload;
                     if ($first_version) {
diff --git a/reporting/templates/tag.tmpl b/reporting/templates/tag.tmpl
index cb1f9df..06d83e9 100644
--- a/reporting/templates/tag.tmpl
+++ b/reporting/templates/tag.tmpl
@@ -44,7 +44,7 @@
             or "$pkg_info->{package} $pkg_info->{type} $pkg_info->{version}" ne "$last_pi->{package} $last_pi->{type} $last_pi->{version}") {
             if ($last) {
                 my $overridden = $has_nonoverridden ? '' : qq{ <span class="type-O">overridden</span>};
-                $OUT .= qq(  <h2 class="tag"><a href="${path_prefix}full/$last->{xref}">);
+                $OUT .= qq(  <h2 class="tag"><a href="${path_prefix}full/$last->{pkg_info}{xref}">);
                 $OUT .= "$last_pi->{package} $last_pi->{version}</a> ($last_pi->{type})$overridden</h2>\n";
                 if ($tag) {
                     $OUT .= qq(  <ul class="tag">\n);
@@ -67,7 +67,7 @@
         }
     }
     my $overridden = $has_nonoverridden ? '' : qq{ <span class="type-O">overridden</span>};
-    $OUT .= qq(  <h2 class="tag"><a href="${path_prefix}full/$last->{xref}">);
+    $OUT .= qq(  <h2 class="tag"><a href="${path_prefix}full/$last->{pkg_info}{xref}">);
     $OUT .= "$last_pi->{package} $last_pi->{version}</a> ($last_pi->{type})$overridden</h2>\n";
     if ($tag) {
         $OUT .= qq(  <ul class="tag">\n);

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


Reply to: