Skip to content

Commit

Permalink
Merge pull request #349 from oli-obk/master
Browse files Browse the repository at this point in the history
Add a new const eval perf problem to the test suite
  • Loading branch information
Mark-Simulacrum authored Feb 21, 2019
2 parents 518b0a7 + 6f8e82e commit a4b9a95
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[package]
name = "ctfe-stress"
name = "ctfe-stress-2"
version = "0.1.0"
authors = ["Ralf Jung <post@ralfj.de>"]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// And without support for loops.

macro_rules! const_repeat {
// Base case: Use 16 at the end to avoid function calls at the leaves as much as possibele.
// Base case: Use 16 at the end to avoid function calls at the leafs as much as possible.
([16] $e: expr, $T: ty) => {{
$e; $e; $e; $e;
$e; $e; $e; $e;
Expand Down Expand Up @@ -60,3 +60,8 @@ expensive_static!(OPS: i32 = ((((10 >> 1) + 3) * 7) / 2 - 12) << 4; [4 16 16 16
expensive_static!(RELOCATIONS : &'static str = "hello"; [8 16 16 16 16]);
expensive_static!(UNSIZE_SLICE: &'static [u8] = b"foo"; [4 16 16 16 16 16]);
expensive_static!(UNSIZE_TRAIT: &'static Trait = &42u32; [4 16 16 16 16 16]);

// copying all these zeros and the corresponding definedness bits can be expensive and is probably
// prone to regressions.
// 24 is an exponent that makes the repeat expression take less than two seconds to compute
const FOO: [i32; 1 << 24] = [0; 1 << 24];

0 comments on commit a4b9a95

Please sign in to comment.