Bug 1369604: Add additional comments to Highlights performance changes. r=mcomella
☠☠ backed out by 07120bb80702 ☠ ☠
authorMichael Comella <michael.l.comella@gmail.com>
Fri, 28 Jul 2017 18:06:48 -0700
changeset 420533 77abc92bd89c3c062124f8bea66efefa08662e1a
parent 420532 fb8b790f8f4759c978c6b49ae15b94804a0d89e9
child 420534 808536f3a29cdffa7100a4f004bc06658b7e25e2
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);