mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Speed up strippingHTML dramatically by calling reserveCharacters with maxCharacters when possible, which is generally much less than the count of preflight characters.
This commit is contained in:
@@ -223,7 +223,12 @@ public extension String {
|
||||
preflight = preflight.removingTagAndContents("style")
|
||||
|
||||
var s = String()
|
||||
s.reserveCapacity(preflight.count)
|
||||
if let maxCharacters {
|
||||
s.reserveCapacity(maxCharacters)
|
||||
}
|
||||
else {
|
||||
s.reserveCapacity(preflight.count)
|
||||
}
|
||||
var lastCharacterWasSpace = false
|
||||
var charactersAdded = 0
|
||||
var level = 0
|
||||
|
||||
Reference in New Issue
Block a user