@@ -28,6 +28,11 @@ flags:
28
28
OS X benchmark driver binaries are placed in ` bin ` alongside ` swiftc ` .
29
29
Additional platform binaries are placed in the ` benchmark/bin ` build directory.
30
30
31
+ The required Swift standard library dylibs are placed in ` lib ` . The
32
+ drivers dynamically link Swift standard library dylibs from a path
33
+ relative to their run-time location (../lib/swift) so the standard
34
+ library should be distributed alongside them.
35
+
31
36
Building Independently
32
37
----------------------
33
38
@@ -43,15 +48,19 @@ The following build options are available:
43
48
* ` -DSWIFT_LIBRARY_PATH `
44
49
* An absolute path to the Swift standard library to use during compilation
45
50
(default: ` swiftc_directory ` /../lib/swift)
51
+ * ` -DSWIFT_DARWIN_XCRUN_TOOLCHAIN `
52
+ * The Xcode toolchain to use when invoking ` xcrun ` to find ` clang ` .
53
+ (default: XcodeDefault)
46
54
* ` -DONLY_PLATFORMS `
47
55
* A list of platforms to build the benchmarks for
48
56
(default: "macosx;iphoneos;appletvos;watchos")
49
57
* ` -DSWIFT_OPTIMIZATION_LEVELS `
50
58
* A list of Swift optimization levels to build against
51
59
(default: "O;Onone;Osize")
52
- * ` -DSWIFT_BENCHMARK_EMIT_SIB `
53
- * A boolean value indicating whether .sib files should be generated
54
- alongside .o files (default: FALSE)
60
+ * ` -DSWIFT_BENCHMARK_USE_OS_LIBRARIES `
61
+ * Enable this option to link the benchmark binaries against the target
62
+ machine's Swift standard library and runtime installed with the OS.
63
+ (default: OFF)
55
64
56
65
The following build targets are available:
57
66
@@ -66,13 +75,40 @@ Build steps (with example options):
66
75
1 . ` $ cd benchmark `
67
76
2 . ` $ mkdir build `
68
77
3 . ` $ cd build `
69
- 4 . ` $ cmake .. `
70
- 5 . ` $ make -j8 swift-benchmark-macosx-x86_64 `
78
+ 4 . ` $ cmake ../benchmark -G Ninja -DSWIFT_EXEC=[path to built swiftc] `
79
+ 5 . ` $ ninja swift-benchmark-macosx-x86_64 `
80
+
81
+ Benchmark binaries are placed in ` bin ` .
82
+
83
+ The binaries dynamically link Swift standard library dylibs from a
84
+ path determined by the configuration. If ` SWIFT_LIBRARY_PATH ` is set,
85
+ they link against the absolute path provided, regardless of where the
86
+ binaries are installed. Otherwise, the runtime library path is
87
+ relative to the benchmark binary at the time it was executed
88
+ (` @executable_path/../lib/swift/<platform> ` ).
89
+
90
+ For example, to benchmark against a locally built ` swiftc ` , including
91
+ any standard library changes in that build, you might configure using:
92
+
93
+ cmake ../benchmark -G Ninja -DSWIFT_EXEC=<src>/swift/build/swift-macosx-x86_64/bin/swiftc
94
+ ninja swift-benchmark-iphoneos-arm64
95
+
96
+ To build against the installed Xcode, simply omit SWIFT_EXEC:
97
+
98
+ cmake ../benchmark -G Ninja
99
+ ninja swift-benchmark-iphoneos-arm64
100
+
101
+ In both examples above, to run the benchmarks on a device, the dynamic
102
+ libraries must then be copied onto the device into the library path
103
+ relative to ` swiftc ` . To benchmark against the target machine's
104
+ installed libraries instead, enable
105
+ ` SWIFT_BENCHMARK_USE_OS_LIBRARIES ` .
106
+
107
+ cmake ../benchmark -G Ninja -DSWIFT_BENCHMARK_USE_OS_LIBRARIES=ON
108
+ ninja swift-benchmark-iphoneos-arm64
71
109
72
- Benchmark driver binaries are placed in ` build/bin ` and the required Swift
73
- standard library dylibs are placed in ` build/lib ` . The drivers dynamically link
74
- Swift standard library dylibs from a path relative to their location
75
- (../lib/swift) so the standard library should be distributed alongside them.
110
+ This will reflect the performance of the Swift standard library
111
+ installed on the device, not the one included in the Swift root.
76
112
77
113
Using the Benchmark Driver
78
114
--------------------------
0 commit comments