Skip to content

Commit

Permalink
Fix brave/brave-ios#8292: Change the minimum number of engines availa…
Browse files Browse the repository at this point in the history
  • Loading branch information
cuba authored Oct 20, 2023
1 parent cf9de8f commit a045a13
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ import os.log
public actor AdBlockStats {
/// The max number of enabled filter lists depending on the amount memory available to the device
static var maxNumberOfAllowedFilterLists: Int = {
let memory = Int(ProcessInfo.processInfo.physicalMemory / 1073741824)
ContentBlockerManager.log.debug("Memory: \(memory)")
return min(5 * memory, 40)
// Get the number of gigs (memory in bytes divided by the size of a gig in bytes)
let numberOfGigs = Int(ProcessInfo.processInfo.physicalMemory / 1073741824)
ContentBlockerManager.log.debug("Number of gigs (rounded down): \(numberOfGigs)")
// Take a value between 20 and 40,
// with the real value somewhere in the middle depending on the device's memory
return max(min(5 * numberOfGigs, 40), 20)
}()

typealias CosmeticFilterModelTuple = (isAlwaysAggressive: Bool, model: CosmeticFilterModel)
Expand Down

0 comments on commit a045a13

Please sign in to comment.