Skip to content

Commit 10087eb

Browse files
authored
Merge pull request #24347 from apple/revert-24326-string-from-file-benchmarks
Revert "Add a benchmark for bridging String(contentsOfFile:...)"
2 parents 18f027a + 2c77f5c commit 10087eb

File tree

1 file changed

+0
-35
lines changed

1 file changed

+0
-35
lines changed

benchmark/single-source/ObjectiveCBridging.swift

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ public let ObjectiveCBridging = [
7373
BenchmarkInfo(name: "ObjectiveCBridgeFromNSDateComponents",
7474
runFunction: run_ObjectiveCBridgeFromNSDateComponents, tags: t,
7575
setUpFunction: setup_dateComponents),
76-
BenchmarkInfo(name: "ObjectiveCBridgeASCIIStringFromFile",
77-
runFunction: run_ASCIIStringFromFile, tags: ts,
78-
setUpFunction: setup_ASCIIStringFromFile),
7976
]
8077

8178
#if _runtime(_ObjC)
@@ -712,35 +709,3 @@ public func run_ObjectiveCBridgeFromNSDateComponents(_ N: Int) {
712709
}
713710
#endif
714711
}
715-
716-
var ASCIIStringFromFile:String? = nil
717-
public func setup_ASCIIStringFromFile() {
718-
#if _runtime(_ObjC)
719-
let url:URL
720-
if #available(OSX 10.12, iOS 10.0, *) {
721-
url = FileManager.default.temporaryDirectory.appendingPathComponent(
722-
"sphinx.txt"
723-
)
724-
} else {
725-
url = URL(fileURLWithPath: "/tmp/sphinx.txt")
726-
}
727-
var str = "Sphinx of black quartz judge my vow"
728-
str = Array(repeating: str, count: 100).joined()
729-
try? str.write(
730-
to: url,
731-
atomically: true,
732-
encoding: .ascii
733-
)
734-
ASCIIStringFromFile = try! String(contentsOf: url, encoding: .ascii)
735-
#endif
736-
}
737-
738-
@inline(never)
739-
public func run_ASCIIStringFromFile(_ N: Int) {
740-
#if _runtime(_ObjC)
741-
for _ in 0 ..< N {
742-
blackHole((ASCIIStringFromFile! + "").utf8.count)
743-
}
744-
#endif
745-
}
746-

0 commit comments

Comments
 (0)