Skip to content

Commit 0a418a4

Browse files
authored
Merge pull request #32 from devMEremenko/terminal-script-original
[Combined] Added a script to run XcodeBenchmark from Terminal
2 parents 4effc13 + b678e52 commit 0a418a4

File tree

3 files changed

+77
-17
lines changed

3 files changed

+77
-17
lines changed

ReadMe.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,32 @@ I believe the results will help developers to make the right *cost/performance*
3636

3737
- Download and install [Xcode](https://apps.apple.com/us/app/xcode/id497799835).
3838
- Open Xcode and install `additional tools` (Xcode should suggest it automatically).
39-
- Perform `defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES` in `Terminal` to show build time in the Xcode progress bar.
40-
- Download and unarchive [XcodeBenchmark](https://github.com/devMEremenko/XcodeBenchmark/archive/master.zip) project.
39+
- [Download](https://github.com/devMEremenko/XcodeBenchmark/archive/master.zip) and unarchive XcodeBenchmark project.
4140

4241
## Before each test
4342

44-
1. Select `XcodeBenchmark` -> `Generic iOS Device` in the top left corner.
45-
2. Close `XcodeBenchmark.xcworkspace` project.
46-
2. Remove the `DerivedData` folder, by selecting Finder, pressing `Shift + Command + G` and paste in the path: `~/Library/Developer/Xcode`, select the `DerivedData` folder and delete it.
47-
3. Disconnect a network cable and turn off WiFi.
48-
4. Make sure to disable all software running at startup: `System Preferences` -> `Users and Groups` -> `User` -> `Login Items` and empty the list.
49-
5. Reboot and cool down your Mac.
50-
6. Connect to the power adapter if you use MacBook.
43+
1. Disconnect the network cable and turn off WiFi.
44+
2. Make sure to disable all software running at startup
45+
- Go to `System Preferences` -> `Users and Groups` -> `User` -> `Login Items`.
46+
- Empty the list.
47+
3. Update `Energy Saver` settings
48+
- Go to `System Preferences` -> `Energy Saver` -> `Turn display off` and set 15 min.
49+
3. Reboot and cool down your Mac.
50+
4. Connect to the power adapter if you use MacBook.
5151

5252
## Running a test
5353

54-
1. Open `XcodeBenchmark.xcworkspace` (please do not confuse with `xcproject`).
55-
2. Press `Command B` to start compilation.
56-
57-
**Important: Start compilation as quickly as possible once you opened a project**
54+
1. Open the `Terminal` app.
55+
2. Write `cd ` and drag & drop `XcodeBenchmark` folder to the `Terminal` app to form `cd path/to/xcode-benchmark`.
56+
2. Run `sh benchmark.sh` in `Terminal`.
57+
3. When `XcodeBenchmark` has completed you will see [this information](img/contribution-example.png).
58+
4. Upload your results, see [Contribution](https://github.com/devMEremenko/XcodeBenchmark#contribution) section.
5859

5960
## FAQ
6061

6162
**Q: What's inside?**
6263

63-
The framework that incudes **42** popular CocoaPods libraries and **70+** dependencies in total.
64+
A framework that includes **42** popular CocoaPods libraries and **70+** dependencies in total.
6465

6566
| Language | files | blank | comment | code |
6667
|---------------|-------|--------|---------|--------|
@@ -79,8 +80,8 @@ The framework that incudes **42** popular CocoaPods libraries and **70+** depend
7980
| SUM: | 6231 | 157270 | 258605 | 790974 |
8081

8182
**Q: What do the results mean?**
82-
1. First of all, the project is **huge**. I think the majority of projects have a smaller size.
83-
2. The results show *relative* performance in Xcode compared to other Macs under the same conditions.
83+
1. First of all, the project is **huge**. Most projects are of a much smaller size.
84+
2. The results show *relative* performance in Xcode, compared to other Macs running under similar conditions.
8485

8586
**Q: Why is CocoaPods not excluded from git-repo?**
8687
- The project is also used by non-programmers. Let's *keep it simple*.
@@ -94,7 +95,7 @@ Make sure:
9495
- [All steps](https://github.com/devMEremenko/XcodeBenchmark#before-each-test) are performed
9596
- `Time` column is still sorted after insertion.
9697
- You are added to the end of the [Contributors](https://github.com/devMEremenko/XcodeBenchmark#contributors) list.
97-
- Attach a screenshot of the Xcode progress bar with a compilation time. [Example](https://user-images.githubusercontent.com/1449655/92333170-05f3f200-f073-11ea-94be-e0a41be5aae4.png).
98+
- Attach a screenshot with a compilation time. [Example](img/contribution-example.png).
9899
- The content in cells is centered. You can use [this tool](https://www.tablesgenerator.com/markdown_tables) to edit a table.
99100
- File -> Paste table data
100101
- Select all cells -> Right click -> Text align -> Center

benchmark.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
readonly PATH_TO_PROJECT=$(pwd)/XcodeBenchmark.xcworkspace
2+
3+
clear
4+
5+
echo "Preparing environment"
6+
7+
START_TIME=$(date +"%T")
8+
9+
defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES
10+
rm -rf ~/Library/Developer/Xcode/DerivedData
11+
12+
if [ -n "$PATH_TO_PROJECT" ]; then
13+
14+
echo "Running XcodeBenchmark..."
15+
echo "Please do not use your Mac while XcodeBenchmark is in progress\n\n"
16+
17+
xcodebuild -workspace "$PATH_TO_PROJECT" \
18+
-scheme XcodeBenchmark \
19+
-destination generic/platform=iOS \
20+
build
21+
22+
echo "System Version:" "$(sw_vers -productVersion)"
23+
xcodebuild -version | grep "Xcode"
24+
25+
echo "Hardware Overview"
26+
system_profiler SPHardwareDataType | grep "Model Name:"
27+
system_profiler SPHardwareDataType | grep "Model Identifier:"
28+
29+
system_profiler SPHardwareDataType | grep "Processor Name:"
30+
system_profiler SPHardwareDataType | grep "Processor Speed:"
31+
system_profiler SPHardwareDataType | grep "Total Number of Cores:"
32+
33+
system_profiler SPHardwareDataType | grep "L2 Cache (per Core):"
34+
system_profiler SPHardwareDataType | grep "L3 Cache:"
35+
36+
system_profiler SPHardwareDataType | grep "Number of Processors:"
37+
system_profiler SPHardwareDataType | grep "Hyper-Threading Technology:"
38+
39+
system_profiler SPHardwareDataType | grep "Memory:"
40+
system_profiler SPSerialATADataType | grep "Model:"
41+
42+
echo ""
43+
echo "✅ XcodeBenchmark has completed"
44+
echo "1️⃣ Take a screenshot of this window (Cmd + Shift + 4 + Space) and resize to include:"
45+
echo "\t- Build Time (See ** BUILD SUCCEEDED ** [XYZ sec])"
46+
echo "\t- System Version"
47+
echo "\t- Xcode Version"
48+
echo "\t- Hardware Overview"
49+
50+
echo "\t- Started" "$START_TIME"
51+
echo "\t- Ended " "$(date +"%T")"
52+
echo "\t- Date" `date`
53+
echo ""
54+
echo "2️⃣ Share your results at https://github.com/devMEremenko/XcodeBenchmark"
55+
56+
else
57+
echo "XcodeBenchmark.xcworkspace was not found in the current folder"
58+
echo "Are you running in the XcodeBenchmark folder?"
59+
fi

img/contribution-example.png

563 KB
Loading

0 commit comments

Comments
 (0)