Bug 1369604: Add additional comments to Highlights performance changes. r=mcomella
☠☠ backed out by f91ecef40cab ☠ ☠
authorMichael Comella <michael.l.comella@gmail.com>
Fri, 28 Jul 2017 18:06:48 -0700
changeset 422897 07ae1124989b5214687b4aafe40fa008345fedd8
parent 422896 10a40b857266d63cf5c0577fd163d896b9c35eca
child 422898 392203e4639777b3cd3049636eca0ccfc922b1e4
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [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);