From c24cd89028e0708ef640b7e6b48e54dd8c750c95 Mon Sep 17 00:00:00 2001
From: Peter Serwylo <peter@serwylo.com>
Date: Sun, 13 Dec 2015 10:28:03 +1100
Subject: [PATCH] Only create compatibility checker once per repo.

Looks like a non-trivial amount of work is done in the constructor
interrogating the features of the current device. This only needs
to be done once.
---
 F-Droid/src/org/fdroid/fdroid/data/RepoPersister.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/F-Droid/src/org/fdroid/fdroid/data/RepoPersister.java b/F-Droid/src/org/fdroid/fdroid/data/RepoPersister.java
index 1164e77c8..2302ddd23 100644
--- a/F-Droid/src/org/fdroid/fdroid/data/RepoPersister.java
+++ b/F-Droid/src/org/fdroid/fdroid/data/RepoPersister.java
@@ -62,9 +62,13 @@ public class RepoPersister {
     @NonNull
     private final Map<String, List<Apk>> apksToSave = new HashMap<>();
 
+    @NonNull
+    private final CompatibilityChecker checker;
+
     public RepoPersister(@NonNull Context context, @NonNull Repo repo) {
         this.repo = repo;
         this.context = context;
+        checker = new CompatibilityChecker(context);
     }
 
     public void saveToDb(App app, List<Apk> packages) throws RepoUpdater.UpdateException {
@@ -281,7 +285,6 @@ public class RepoPersister {
      * in order to see if, and why an apk is not compatible.
      */
     private void calcApkCompatibilityFlags(List<Apk> apks) {
-        final CompatibilityChecker checker = new CompatibilityChecker(context);
         for (final Apk apk : apks) {
             final List<String> reasons = checker.getIncompatibleReasons(apk);
             if (reasons.size() > 0) {