Skip to content

[SR-9222] XCTest performance tests are always much slower on the first measurement #358

@swift-ci

Description

@swift-ci
Previous ID SR-9222
Radar None
Original Reporter bnut (JIRA User)
Type Bug

Attachment: Download

Environment
Xcode 10.1 (10B61)
MacBook Pro (15-inch, 2016)
2.9 GHz Intel Core i7
16 GB 2133 MHz LPDDR3
Additional Detail from JIRA
Votes 0
Component/s XCTest
Labels Bug
Assignee None
Priority Medium

md5: d535dadca1b8fdfb15ae346fea01370a

Issue Description:

Using the measure block in XCTest always results in a significant overhead on the first measurement.

import XCTest
@testable import xctperf_test


final class xctperf_testTests: XCTestCase {
    func testExample() {
        measure {
            for _ in 0 ... 10_000 {
                XCTAssertEqual("abc", "abc")
            }
        }
    }


    static var allTests = [
        ("testExample", testExample),
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions