Bug 1369604: Add additional comments to Highlights performance changes. r=mcomella
authorMichael Comella <michael.l.comella@gmail.com>
Fri, 28 Jul 2017 18:06:48 -0700
changeset 420722 8227a596f3fd5de690caf5e8d66d731b50f1c6ed
parent 420721 95ca4a6f89572763b25a41403861871104af6f44
child 420723 5bc2b72074a38e3b7101a8afdb7457f5241c427c
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs1369604
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1369604: Add additional comments to Highlights performance changes. r=mcomella MozReview-Commit-ID: A5uzxbKisWF
mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/model/Highlight.java
mobile/android/base/java/org/mozilla/gecko/activitystream/ranking/HighlightsRanking.java
--- a/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/model/Highlight.java
+++ b/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/model/Highlight.java
@@ -34,17 +34,17 @@ public class Highlight implements Item {
 
     private final String title;
     private final String url;
     private final Utils.HighlightSource source;
     private final long time;
 
     private long historyId;
 
-    private @Nullable Metadata metadata;
+    private @Nullable Metadata metadata; // lazily-loaded.
     private @Nullable final String metadataJSON;
     private @Nullable String fastImageURL;
     private int fastDescriptionLength;
 
     private @Nullable Boolean isPinned;
     private @Nullable Boolean isBookmarked;
 
     public static Highlight fromCursor(final Cursor cursor, final HighlightCandidateCursorIndices cursorIndices) {
--- a/mobile/android/base/java/org/mozilla/gecko/activitystream/ranking/HighlightsRanking.java
+++ b/mobile/android/base/java/org/mozilla/gecko/activitystream/ranking/HighlightsRanking.java
@@ -85,16 +85,19 @@ public class HighlightsRanking {
             FEATURE_PATH_LENGTH,
             FEATURE_IMAGE_SIZE,
     };
 
     private static final double BOOKMARK_AGE_DIVIDEND = 3 * 24 * 60 * 60 * 1000;
 
     /**
      * Create a list of highlights based on the candidates provided by the input cursor.
+     *
+     * THIS METHOD IS CRITICAL FOR HIGHLIGHTS PERFORMANCE AND HAS BEEN OPTIMIZED (bug 1369604):
+     * please be careful what you add to it!
      */
     public static List<Highlight> rank(Cursor cursor, int limit) {
         List<HighlightCandidate> highlights = extractFeatures(cursor);
 
         normalize(highlights);
 
         scoreEntries(highlights);