Skip to content

Box::new() performance regression between 1.18 and 1.19 beta #42562

Closed
@rom1v

Description

@rom1v

It seems there is a performance regression related to Box::new() between 1.18 and 1.19 beta.

use std::time::Instant;

fn main() {
    let timer = Instant::now();
    for _ in 0..100000 {
        Box::new([0; 1000]);
    }
    println!("{:?}", timer.elapsed());
}

In Release/Stable:

rustc 1.18.0 (03fc9d622 2017-06-06)

Duration { secs: 0, nanos: 107624 }

In Release/Beta, it's ~200× slower:

rustc 1.19.0-beta.1 (a87984118 2017-06-06)

Duration { secs: 0, nanos: 22355940 }

https://is.gd/AaDx3A

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-slowIssue: Problems and improvements with respect to performance of generated code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions