From a0770c14c5bd072f1ca5e27adc76448b9c7042a7 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 17 Dec 2018 16:48:32 -0700 Subject: [PATCH] baseline perf test for migration --- Signal.xcodeproj/project.pbxproj | 4 ++ ...F29A0D38-3F89-44CA-8BDC-C99EE6C1AB81.plist | 22 +++++++ ...F934A594-2E7D-49A5-9B1B-63A05DABCE3C.plist | 22 +++++++ .../Info.plist | 62 +++++++++++++++++++ Signal/test/Models/MantlePerfTest.swift | 42 +++++++++++++ .../migrations/OWS110SortIdMigration.swift | 2 +- 6 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 Signal.xcodeproj/xcshareddata/xcbaselines/D221A0A9169C9E5F00537ABF.xcbaseline/F29A0D38-3F89-44CA-8BDC-C99EE6C1AB81.plist create mode 100644 Signal.xcodeproj/xcshareddata/xcbaselines/D221A0A9169C9E5F00537ABF.xcbaseline/F934A594-2E7D-49A5-9B1B-63A05DABCE3C.plist create mode 100644 Signal/test/Models/MantlePerfTest.swift diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 0375a76c9..5c42ef763 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -443,6 +443,7 @@ 45FBC5C81DF8575700E9B410 /* CallKitCallManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45FBC59A1DF8575700E9B410 /* CallKitCallManager.swift */; }; 45FBC5D11DF8592E00E9B410 /* SignalCall.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45FBC5D01DF8592E00E9B410 /* SignalCall.swift */; }; 4AC4EA13C8A444455DAB351F /* Pods_SignalMessaging.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 264242150E87D10A357DB07B /* Pods_SignalMessaging.framework */; }; + 4C04F58421C860C50090D0BB /* MantlePerfTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C04F58321C860C50090D0BB /* MantlePerfTest.swift */; }; 4C090A1B210FD9C7001FD7F9 /* HapticFeedback.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C090A1A210FD9C7001FD7F9 /* HapticFeedback.swift */; }; 4C11AA5020FD59C700351FBD /* MessageStatusView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C11AA4F20FD59C700351FBD /* MessageStatusView.swift */; }; 4C13C9F620E57BA30089A98B /* ColorPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C13C9F520E57BA30089A98B /* ColorPickerViewController.swift */; }; @@ -1159,6 +1160,7 @@ 45F659811E1BE77000444429 /* NonCallKitCallUIAdaptee.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NonCallKitCallUIAdaptee.swift; sourceTree = ""; }; 45FBC59A1DF8575700E9B410 /* CallKitCallManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallKitCallManager.swift; sourceTree = ""; }; 45FBC5D01DF8592E00E9B410 /* SignalCall.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignalCall.swift; sourceTree = ""; }; + 4C04F58321C860C50090D0BB /* MantlePerfTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MantlePerfTest.swift; path = Models/MantlePerfTest.swift; sourceTree = ""; }; 4C090A1A210FD9C7001FD7F9 /* HapticFeedback.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = HapticFeedback.swift; path = UserInterface/HapticFeedback.swift; sourceTree = ""; }; 4C11AA4F20FD59C700351FBD /* MessageStatusView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageStatusView.swift; sourceTree = ""; }; 4C13C9F520E57BA30089A98B /* ColorPickerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPickerViewController.swift; sourceTree = ""; }; @@ -2192,6 +2194,7 @@ 458E38381D6699110094BD24 /* Models */ = { isa = PBXGroup; children = ( + 4C04F58321C860C50090D0BB /* MantlePerfTest.swift */, 4C4BC6C22102D697004040C9 /* ContactDiscoveryOperationTest.swift */, 458E38391D6699FA0094BD24 /* OWSDeviceProvisioningURLParserTest.m */, 458967101DC117CC00E9DD21 /* AccountManagerTest.swift */, @@ -3626,6 +3629,7 @@ 458E383A1D6699FA0094BD24 /* OWSDeviceProvisioningURLParserTest.m in Sources */, 3421981C21061D2E00C57195 /* ByteParserTest.swift in Sources */, 34843B26214327C9004DED45 /* OWSOrphanDataCleanerTest.m in Sources */, + 4C04F58421C860C50090D0BB /* MantlePerfTest.swift in Sources */, 45360B901F9527DA00FA666C /* SearcherTest.swift in Sources */, 34DB0BED2011548B007B313F /* OWSDatabaseConverterTest.m in Sources */, 34843B2C214FE296004DED45 /* MockEnvironment.m in Sources */, diff --git a/Signal.xcodeproj/xcshareddata/xcbaselines/D221A0A9169C9E5F00537ABF.xcbaseline/F29A0D38-3F89-44CA-8BDC-C99EE6C1AB81.plist b/Signal.xcodeproj/xcshareddata/xcbaselines/D221A0A9169C9E5F00537ABF.xcbaseline/F29A0D38-3F89-44CA-8BDC-C99EE6C1AB81.plist new file mode 100644 index 000000000..1da1ffd17 --- /dev/null +++ b/Signal.xcodeproj/xcshareddata/xcbaselines/D221A0A9169C9E5F00537ABF.xcbaseline/F29A0D38-3F89-44CA-8BDC-C99EE6C1AB81.plist @@ -0,0 +1,22 @@ + + + + + classNames + + MantlePerfTest + + testPerformanceExample() + + com.apple.XCTPerformanceMetric_WallClockTime + + baselineAverage + 3.19 + baselineIntegrationDisplayName + Local Baseline + + + + + + diff --git a/Signal.xcodeproj/xcshareddata/xcbaselines/D221A0A9169C9E5F00537ABF.xcbaseline/F934A594-2E7D-49A5-9B1B-63A05DABCE3C.plist b/Signal.xcodeproj/xcshareddata/xcbaselines/D221A0A9169C9E5F00537ABF.xcbaseline/F934A594-2E7D-49A5-9B1B-63A05DABCE3C.plist new file mode 100644 index 000000000..87aa99390 --- /dev/null +++ b/Signal.xcodeproj/xcshareddata/xcbaselines/D221A0A9169C9E5F00537ABF.xcbaseline/F934A594-2E7D-49A5-9B1B-63A05DABCE3C.plist @@ -0,0 +1,22 @@ + + + + + classNames + + MantlePerfTest + + testPerformanceExample() + + com.apple.XCTPerformanceMetric_WallClockTime + + baselineAverage + 0.62862 + baselineIntegrationDisplayName + Local Baseline + + + + + + diff --git a/Signal.xcodeproj/xcshareddata/xcbaselines/D221A0A9169C9E5F00537ABF.xcbaseline/Info.plist b/Signal.xcodeproj/xcshareddata/xcbaselines/D221A0A9169C9E5F00537ABF.xcbaseline/Info.plist index 78d6282c7..757f83b99 100644 --- a/Signal.xcodeproj/xcshareddata/xcbaselines/D221A0A9169C9E5F00537ABF.xcbaseline/Info.plist +++ b/Signal.xcodeproj/xcshareddata/xcbaselines/D221A0A9169C9E5F00537ABF.xcbaseline/Info.plist @@ -35,6 +35,68 @@ com.apple.platform.iphonesimulator + F29A0D38-3F89-44CA-8BDC-C99EE6C1AB81 + + localComputer + + busSpeedInMHz + 100 + cpuCount + 1 + cpuKind + Intel Core i7 + cpuSpeedInMHz + 2900 + logicalCPUCoresPerPackage + 8 + modelCode + MacBookPro14,3 + physicalCPUCoresPerPackage + 4 + platformIdentifier + com.apple.platform.macosx + + targetArchitecture + x86_64 + targetDevice + + modelCode + iPhone10,6 + platformIdentifier + com.apple.platform.iphonesimulator + + + F934A594-2E7D-49A5-9B1B-63A05DABCE3C + + localComputer + + busSpeedInMHz + 100 + cpuCount + 1 + cpuKind + Intel Core i7 + cpuSpeedInMHz + 2900 + logicalCPUCoresPerPackage + 8 + modelCode + MacBookPro14,3 + physicalCPUCoresPerPackage + 4 + platformIdentifier + com.apple.platform.macosx + + targetArchitecture + x86_64 + targetDevice + + modelCode + iPhone7,2 + platformIdentifier + com.apple.platform.iphonesimulator + + diff --git a/Signal/test/Models/MantlePerfTest.swift b/Signal/test/Models/MantlePerfTest.swift new file mode 100644 index 000000000..d0e6eadaa --- /dev/null +++ b/Signal/test/Models/MantlePerfTest.swift @@ -0,0 +1,42 @@ +// +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// + +import XCTest +@testable import SignalMessaging +@testable import SignalServiceKit + +class MantlePerfTest: SignalBaseTest { + + var primaryStorage: OWSPrimaryStorage { + return SSKEnvironment.shared.primaryStorage + } + + override func setUp() { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testPerformanceExample() { + let migration = OWS110SortIdMigration() + + self.measureMetrics(XCTestCase.defaultPerformanceMetrics, automaticallyStartMeasuring: false) { + _ = OutgoingMessageFactory().create(count: 100) + + startMeasuring() + + let migrationCompleted = expectation(description: "migrationCompleted") + migration.runUp(completion: migrationCompleted.fulfill) + + self.wait(for: [migrationCompleted], timeout: 10) + + stopMeasuring() + + TSInteraction.removeAllObjectsInCollection() + } + } + +} diff --git a/SignalMessaging/environment/migrations/OWS110SortIdMigration.swift b/SignalMessaging/environment/migrations/OWS110SortIdMigration.swift index af4c2cddb..babcf9951 100644 --- a/SignalMessaging/environment/migrations/OWS110SortIdMigration.swift +++ b/SignalMessaging/environment/migrations/OWS110SortIdMigration.swift @@ -4,7 +4,7 @@ import Foundation -class OWS110SortIdMigration: OWSDatabaseMigration { +public class OWS110SortIdMigration: OWSDatabaseMigration { // increment a similar constant for each migration. @objc class func migrationId() -> String {