Skip to content

[SR-9284] Performance regression in toolchain 2018-11-15 #51756

@nsalmoria

Description

@nsalmoria
Previous ID SR-9284
Radar rdar://46277030
Original Reporter @nsalmoria
Type Bug

Attachment: Download

Environment

macOS 10.14.1, Xcode 10.1, Swift Development Snapshot 2018-11-15 (a)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 5.0Regression, Performance
Assignee None
Priority Medium

md5: 79e0114211edefa4133861588e7950a1

Issue Description:

This program:

import Foundation

func test() {
    let array = [0]

    let start = Date()

    for _ in 0...10_000_000 {
        var copy = array
        copy[0] = 0
    }

    let end = Date()

    print("\(end.timeIntervalSince(start)) seconds")
}

test()

compiled with -O, runs in 2.6 seconds when compiled with Xcode 10.1 and default toolchain, but only in 7.1 seconds when compiled with toolchain 2018-11-15.

Attached is the source and the output of -emit-sil with both toolchains.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfperformanceregressionswift 5.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions