Skip to content

[SR-7632] Initializing an Int Array with 2000 elements takes more than 4 seconds #50173

@swift-ci

Description

@swift-ci
Previous ID SR-7632
Radar rdar://problem/29358447
Original Reporter andreasw (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment

Ubuntu 17.10, Swift 4.1, Dell Latitude

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee andreasw (JIRA)
Priority Medium

md5: c140d89b8695a1d83b04eca03543c3fc

Issue Description:

Compilation of

let x = [0, 1, 2, 3, ..., 2000]

takes >4 seconds on my laptop.

The same in C++ with clang takes less than 0.2 seconds.

int x[] = {0, 1, 2, 3, ..., 2000}

It gets worse with 5.000 or 20.000 elements, numbers that are not unusual when working with large predefined matrices.

I generated the elements with bash:

seq -s, 2000

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfexpressionsFeature: expressionsliteralsFeature → expressions: Literals such as an integer or string literalperformanceswift 4.2type checkerArea → compiler: Semantic analysis

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions