run benchmarks with input

This commit is contained in:
Anton-4 2021-05-28 15:08:46 +02:00
parent 6db9247509
commit 05645088b7
12 changed files with 144 additions and 272 deletions

241
Cargo.lock generated
View file

@ -1,5 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "ab_glyph"
version = "0.2.10"
@ -45,7 +47,7 @@ checksum = "7f200cbb1e856866d9eade941cf3aa0c5d7dd36f74311c4273b494f4ef036957"
dependencies = [
"getrandom 0.2.2",
"once_cell",
"version_check 0.9.3",
"version_check",
]
[[package]]
@ -135,7 +137,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc 0.2.93",
"libc",
"winapi 0.3.9",
]
@ -159,7 +161,7 @@ checksum = "9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc"
dependencies = [
"addr2line",
"cfg-if 1.0.0",
"libc 0.2.93",
"libc",
"miniz_oxide",
"object 0.23.0",
"rustc-demangle",
@ -180,12 +182,6 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
[[package]]
name = "bit_field"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4"
[[package]]
name = "bitflags"
version = "1.2.1"
@ -428,7 +424,7 @@ dependencies = [
"core-foundation 0.9.1",
"core-graphics 0.22.2",
"foreign-types",
"libc 0.2.93",
"libc",
"objc",
]
@ -443,7 +439,7 @@ dependencies = [
"core-foundation 0.9.1",
"core-graphics-types",
"foreign-types",
"libc 0.2.93",
"libc",
"objc",
]
@ -515,7 +511,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171"
dependencies = [
"core-foundation-sys 0.7.0",
"libc 0.2.93",
"libc",
]
[[package]]
@ -525,7 +521,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62"
dependencies = [
"core-foundation-sys 0.8.2",
"libc 0.2.93",
"libc",
]
[[package]]
@ -549,7 +545,7 @@ dependencies = [
"bitflags",
"core-foundation 0.7.0",
"foreign-types",
"libc 0.2.93",
"libc",
]
[[package]]
@ -562,7 +558,7 @@ dependencies = [
"core-foundation 0.9.1",
"core-graphics-types",
"foreign-types",
"libc 0.2.93",
"libc",
]
[[package]]
@ -574,7 +570,7 @@ dependencies = [
"bitflags",
"core-foundation 0.9.1",
"foreign-types",
"libc 0.2.93",
"libc",
]
[[package]]
@ -586,7 +582,7 @@ dependencies = [
"cfg-if 0.1.10",
"core-foundation-sys 0.7.0",
"core-graphics 0.19.2",
"libc 0.2.93",
"libc",
"objc",
]
@ -625,16 +621,6 @@ dependencies = [
"walkdir",
]
[[package]]
name = "criterion-perf-events"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e28da8efb44be0b107d9a983d01984e26362249dc30961a2ed3859606d8ddfe1"
dependencies = [
"criterion",
"perfcnt",
]
[[package]]
name = "criterion-plot"
version = "0.4.3"
@ -892,7 +878,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
dependencies = [
"libc 0.2.93",
"libc",
"redox_users",
"winapi 0.3.9",
]
@ -1000,7 +986,7 @@ checksum = "cd3aec53de10fe96d7d8c565eb17f2c687bb5518a2ec453b5b1252964526abe0"
dependencies = [
"cfg-if 1.0.0",
"crc32fast",
"libc 0.2.93",
"libc",
"miniz_oxide",
]
@ -1164,7 +1150,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [
"cfg-if 1.0.0",
"libc 0.2.93",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
]
@ -1175,7 +1161,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
dependencies = [
"cfg-if 1.0.0",
"libc 0.2.93",
"libc",
"wasi 0.10.2+wasi-snapshot-preview1",
]
@ -1463,7 +1449,7 @@ version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c"
dependencies = [
"libc 0.2.93",
"libc",
]
[[package]]
@ -1472,12 +1458,6 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "iai"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71a816c97c42258aa5834d07590b718b4c9a598944cd39a52dc25b351185d678"
[[package]]
name = "ident_case"
version = "1.0.1"
@ -1495,7 +1475,7 @@ dependencies = [
"rand_xoshiro",
"sized-chunks 0.5.3",
"typenum",
"version_check 0.9.3",
"version_check",
]
[[package]]
@ -1509,7 +1489,7 @@ dependencies = [
"rand_xoshiro",
"sized-chunks 0.6.4",
"typenum",
"version_check 0.9.3",
"version_check",
]
[[package]]
@ -1523,7 +1503,7 @@ dependencies = [
"rand_xoshiro",
"sized-chunks 0.5.3",
"typenum",
"version_check 0.9.3",
"version_check",
]
[[package]]
@ -1537,7 +1517,7 @@ dependencies = [
"rand_xoshiro",
"sized-chunks 0.6.4",
"typenum",
"version_check 0.9.3",
"version_check",
]
[[package]]
@ -1589,7 +1569,7 @@ source = "git+https://github.com/rtfeldman/inkwell?tag=llvm10-0.release4#9ae45f0
dependencies = [
"either",
"inkwell_internals",
"libc 0.2.93",
"libc",
"llvm-sys",
"once_cell",
"parking_lot",
@ -1633,7 +1613,7 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
dependencies = [
"libc 0.2.93",
"libc",
]
[[package]]
@ -1672,7 +1652,7 @@ version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2"
dependencies = [
"libc 0.2.93",
"libc",
]
[[package]]
@ -1700,7 +1680,7 @@ version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b19cc4a81304db2a0ad69740e83cdc3a9364e3f9bd6d88a87288a4c2deec927b"
dependencies = [
"libc 0.2.93",
"libc",
"libloading 0.6.7",
]
@ -1722,12 +1702,6 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e32a70cf75e5846d53a673923498228bbec6a8624708a9ea5645f075d6276122"
[[package]]
name = "libc"
version = "0.2.93"
@ -1768,7 +1742,7 @@ checksum = "15d9c00ce56221b2150e2d4d51887ff139fce5a0e50346c744861d1e66d2f7c4"
dependencies = [
"cc",
"lazy_static",
"libc 0.2.93",
"libc",
"regex",
"semver",
]
@ -1797,7 +1771,7 @@ version = "0.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
dependencies = [
"libc 0.2.93",
"libc",
]
[[package]]
@ -1824,7 +1798,7 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b70ca2a6103ac8b665dc150b142ef0e4e89df640c9e6cf295d189c3caebe5a"
dependencies = [
"libc 0.2.93",
"libc",
]
[[package]]
@ -1880,7 +1854,7 @@ dependencies = [
"fuchsia-zircon-sys",
"iovec",
"kernel32-sys",
"libc 0.2.93",
"libc",
"log",
"miow",
"net2",
@ -1912,16 +1886,6 @@ dependencies = [
"ws2_32-sys",
]
[[package]]
name = "mmap"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bc85448a6006dd2ba26a385a564a8a0f1f2c7e78c70f1a70b2e0f4af286b823"
dependencies = [
"libc 0.1.12",
"tempdir",
]
[[package]]
name = "naga"
version = "0.3.2"
@ -1957,7 +1921,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdf399b8b7a39c6fb153c4ec32c72fd5fe789df24a647f229c239aa7adb15241"
dependencies = [
"lazy_static",
"libc 0.2.93",
"libc",
"log",
"ndk",
"ndk-macro",
@ -1990,7 +1954,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae"
dependencies = [
"cfg-if 0.1.10",
"libc 0.2.93",
"libc",
"winapi 0.3.9",
]
@ -2003,7 +1967,7 @@ dependencies = [
"bitflags",
"cc",
"cfg-if 0.1.10",
"libc 0.2.93",
"libc",
"void",
]
@ -2016,7 +1980,7 @@ dependencies = [
"bitflags",
"cc",
"cfg-if 0.1.10",
"libc 0.2.93",
"libc",
]
[[package]]
@ -2028,17 +1992,7 @@ dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc 0.2.93",
]
[[package]]
name = "nom"
version = "4.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6"
dependencies = [
"memchr",
"version_check 0.1.5",
"libc",
]
[[package]]
@ -2048,7 +2002,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2"
dependencies = [
"memchr",
"version_check 0.9.3",
"version_check",
]
[[package]]
@ -2073,7 +2027,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
dependencies = [
"hermit-abi",
"libc 0.2.93",
"libc",
]
[[package]]
@ -2215,7 +2169,7 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eebde548fbbf1ea81a99b128872779c437752fb99f217c45245e1a61dcd9edcd"
dependencies = [
"libc 0.2.93",
"libc",
"winapi 0.3.9",
]
@ -2263,7 +2217,7 @@ dependencies = [
"backtrace",
"cfg-if 1.0.0",
"instant",
"libc 0.2.93",
"libc",
"petgraph",
"redox_syscall 0.2.5",
"smallvec",
@ -2277,21 +2231,6 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]]
name = "perfcnt"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88a4decf2d171c232d741ca37d590cd50d35314b7d348198e7e474e0bf34c8b4"
dependencies = [
"bitflags",
"byteorder",
"libc 0.2.93",
"mmap",
"nom 4.2.3",
"phf",
"x86",
]
[[package]]
name = "pest"
version = "2.1.3"
@ -2482,7 +2421,7 @@ dependencies = [
"proc-macro2 1.0.26",
"quote 1.0.9",
"syn 1.0.65",
"version_check 0.9.3",
"version_check",
]
[[package]]
@ -2495,7 +2434,7 @@ dependencies = [
"quote 1.0.9",
"syn 1.0.65",
"syn-mid",
"version_check 0.9.3",
"version_check",
]
[[package]]
@ -2602,19 +2541,6 @@ dependencies = [
"proc-macro2 1.0.26",
]
[[package]]
name = "rand"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
dependencies = [
"fuchsia-cprng",
"libc 0.2.93",
"rand_core 0.3.1",
"rdrand",
"winapi 0.3.9",
]
[[package]]
name = "rand"
version = "0.6.5"
@ -2622,7 +2548,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
dependencies = [
"autocfg 0.1.7",
"libc 0.2.93",
"libc",
"rand_chacha 0.1.1",
"rand_core 0.4.2",
"rand_hc 0.1.0",
@ -2641,7 +2567,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom 0.1.16",
"libc 0.2.93",
"libc",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"rand_hc 0.2.0",
@ -2654,7 +2580,7 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
dependencies = [
"libc 0.2.93",
"libc",
"rand_chacha 0.3.0",
"rand_core 0.6.2",
"rand_hc 0.3.0",
@ -2765,7 +2691,7 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
dependencies = [
"libc 0.2.93",
"libc",
"rand_core 0.4.2",
"winapi 0.3.9",
]
@ -2778,7 +2704,7 @@ checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
dependencies = [
"cloudabi",
"fuchsia-cprng",
"libc 0.2.93",
"libc",
"rand_core 0.4.2",
"rdrand",
"winapi 0.3.9",
@ -2827,22 +2753,13 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63e935c45e09cc6dcf00d2f0b2d630a58f4095320223d47fc68918722f0538b6"
[[package]]
name = "raw-cpuid"
version = "9.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c27cb5785b85bd05d4eb171556c9a1a514552e26123aeae6bb7d811353148026"
dependencies = [
"bitflags",
]
[[package]]
name = "raw-window-handle"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a441a7a6c80ad6473bd4b74ec1c9a4c951794285bf941c2126f607c72e48211"
dependencies = [
"libc 0.2.93",
"libc",
]
[[package]]
@ -3021,17 +2938,14 @@ dependencies = [
"cli_utils",
"const_format",
"criterion",
"criterion-perf-events",
"iai",
"im 14.3.0",
"im-rc 14.3.0",
"indoc 0.3.6",
"inkwell",
"inlinable_string",
"libc 0.2.93",
"libc",
"libloading 0.6.7",
"maplit",
"perfcnt",
"pretty_assertions 0.5.1",
"quickcheck 0.8.5",
"quickcheck_macros 0.8.0",
@ -3126,7 +3040,7 @@ dependencies = [
"im-rc 15.0.0",
"indoc 1.0.3",
"inlinable_string",
"libc 0.2.93",
"libc",
"log",
"maplit",
"nonempty",
@ -3189,7 +3103,7 @@ dependencies = [
"indoc 0.3.6",
"inkwell",
"inlinable_string",
"libc 0.2.93",
"libc",
"maplit",
"pretty_assertions 0.5.1",
"quickcheck 0.8.5",
@ -3223,7 +3137,7 @@ dependencies = [
"indoc 0.3.6",
"inlinable_string",
"itertools 0.9.0",
"libc 0.2.93",
"libc",
"libloading 0.6.7",
"maplit",
"object 0.22.0",
@ -3415,7 +3329,7 @@ dependencies = [
name = "roc_std"
version = "0.1.0"
dependencies = [
"libc 0.2.93",
"libc",
]
[[package]]
@ -3495,7 +3409,7 @@ source = "git+https://github.com/rtfeldman/rustyline?tag=prompt-fix#a6b8a20d2bf5
dependencies = [
"cfg-if 0.1.10",
"dirs-next",
"libc 0.2.93",
"libc",
"log",
"memchr",
"nix 0.17.0",
@ -3853,16 +3767,6 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d"
[[package]]
name = "tempdir"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
dependencies = [
"rand 0.4.6",
"remove_dir_all",
]
[[package]]
name = "tempfile"
version = "3.2.0"
@ -3870,7 +3774,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
dependencies = [
"cfg-if 1.0.0",
"libc 0.2.93",
"libc",
"rand 0.8.3",
"redox_syscall 0.2.5",
"remove_dir_all",
@ -3897,7 +3801,7 @@ dependencies = [
"indoc 0.3.6",
"inkwell",
"inlinable_string",
"libc 0.2.93",
"libc",
"libloading 0.6.7",
"maplit",
"quickcheck 0.8.5",
@ -3958,7 +3862,7 @@ version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1"
dependencies = [
"libc 0.2.93",
"libc",
"redox_syscall 0.1.57",
"winapi 0.3.9",
]
@ -4081,7 +3985,7 @@ version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
dependencies = [
"version_check 0.9.3",
"version_check",
]
[[package]]
@ -4158,12 +4062,6 @@ dependencies = [
"typed-arena",
]
[[package]]
name = "version_check"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
[[package]]
name = "version_check"
version = "0.9.3"
@ -4288,7 +4186,7 @@ checksum = "06ca44d86554b85cf449f1557edc6cc7da935cc748c8e4bf1c507cbd43bae02c"
dependencies = [
"bitflags",
"downcast-rs",
"libc 0.2.93",
"libc",
"nix 0.20.0",
"scoped-tls",
"wayland-commons",
@ -4491,7 +4389,7 @@ dependencies = [
"dispatch",
"instant",
"lazy_static",
"libc 0.2.93",
"libc",
"log",
"mio",
"mio-extras",
@ -4552,33 +4450,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bf981e3a5b3301209754218f962052d4d9ee97e478f4d26d4a6eced34c1fef8"
dependencies = [
"lazy_static",
"libc 0.2.93",
"libc",
"maybe-uninit",
"pkg-config",
]
[[package]]
name = "x86"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4fd9298cd1b1f88546fc0a5e8faa3354013cd010589299c624fde436aad76cc"
dependencies = [
"bit_field",
"bitflags",
"csv",
"phf",
"phf_codegen",
"raw-cpuid",
"serde_json",
]
[[package]]
name = "xcb"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62056f63138b39116f82a540c983cc11f1c90cd70b3d492a70c25eaa50bd22a6"
dependencies = [
"libc 0.2.93",
"libc",
"log",
]
@ -4588,7 +4471,7 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a9a231574ae78801646617cefd13bfe94be907c0e4fa979cfd8b770aa3c5d08"
dependencies = [
"nom 6.1.2",
"nom",
]
[[package]]

View file

@ -116,5 +116,5 @@ bench-roc:
ENV RUST_BACKTRACE=full
RUN cargo criterion -V
RUN --privileged --mount=type=cache,target=$SCCACHE_DIR \
cd cli && cargo bench instructions_bench && cargo criterion --bench time_bench && sccache --show-stats
cd cli && cargo criterion && sccache --show-stats

View file

@ -96,14 +96,15 @@ serial_test = "0.5"
tempfile = "3.1.0"
criterion = "0.3.4"
cli_utils = { path = "cli_utils" }
iai = "0.1"
criterion-perf-events = "0.1.3"
perfcnt = "0.7.1"
# Keep the commented deps, they are commented because they require nightly rust
# criterion-perf-events = "0.1.3"
# perfcnt = "0.7.1"
[[bench]]
name = "time_bench"
harness = false
[[bench]]
name = "events_bench"
harness = false
# Keep this benchmark, it's commented because it requires nightly
# [[bench]]
# name = "events_bench"
# harness = false

View file

@ -1,14 +1,12 @@
use cli_utils::bench_utils::{
bench_cfold, bench_deriv, bench_nqueens,
bench_rbtree_ck, bench_rbtree_delete,
// Keep this benchmark. It's commented because it requires nightly rust.
/*use cli_utils::bench_utils::{
bench_cfold, bench_deriv, bench_nqueens, bench_rbtree_ck, bench_rbtree_delete,
};
use criterion_perf_events::Perf;
use perfcnt::linux::HardwareEventType as Hardware;
use perfcnt::linux::PerfCounterBuilderLinux as Builder;
use criterion::{
criterion_group, criterion_main, BenchmarkGroup, Criterion, SamplingMode,
};
use criterion::{criterion_group, criterion_main, BenchmarkGroup, Criterion, SamplingMode};
fn bench_group(c: &mut Criterion<Perf>, hw_event_str: &str) {
let mut group = c.benchmark_group(format!("bench-group_no-opt_{}", hw_event_str));
@ -17,10 +15,10 @@ fn bench_group(c: &mut Criterion<Perf>, hw_event_str: &str) {
let bench_funcs: Vec<fn(Option<&mut BenchmarkGroup<Perf>>) -> ()> = vec![
bench_nqueens,
/*bench_cfold,
bench_cfold,
bench_deriv,
bench_rbtree,
bench_rbtree_delete,*/
bench_rbtree_ck,
bench_rbtree_delete,
// TODO quicksort
];
@ -34,12 +32,7 @@ fn bench_group(c: &mut Criterion<Perf>, hw_event_str: &str) {
use perfcnt::linux::HardwareEventType;
fn init_criterion(event: HardwareEventType) -> Criterion<Perf> {
Criterion::default()
.with_measurement(
Perf::new(
Builder::from_hardware_event(event)
)
)
Criterion::default().with_measurement(Perf::new(Builder::from_hardware_event(event)))
}
fn bench_instructions(c: &mut Criterion<Perf>) {
@ -92,5 +85,10 @@ criterion_group!(
targets = bench_branch_misses
);
criterion_main!(benches_instructions, benches_cache_refs, benches_cache_misses, benches_branch_instructions, benches_branch_misses);
criterion_main!(
benches_instructions,
benches_cache_refs,
benches_cache_misses,
benches_branch_instructions,
benches_branch_misses
);*/

View file

@ -1,6 +1,5 @@
use cli_utils::bench_utils::{
bench_cfold, bench_deriv, bench_nqueens,
bench_rbtree_ck, bench_rbtree_delete,
bench_cfold, bench_deriv, bench_nqueens, bench_rbtree_ck, bench_rbtree_delete,
};
use criterion::{
criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion, SamplingMode,
@ -13,7 +12,7 @@ fn bench_group_wall_time(c: &mut Criterion) {
group.sample_size(200);
let bench_funcs: Vec<fn(Option<&mut BenchmarkGroup<WallTime>>) -> ()> = vec![
bench_nqueens, // 11
bench_nqueens, // queens 11
bench_cfold, // e = mkExpr 12 1
bench_deriv, // nest deriv 7 f
bench_rbtree_ck, // ms = makeMap 5 5600

View file

@ -1,33 +1,15 @@
use crate::helpers::{example_file, run_cmd, run_roc};
use criterion::{BenchmarkGroup, black_box, measurement::{Measurement, WallTime}};
use criterion::{black_box, measurement::Measurement, BenchmarkGroup};
use std::path::Path;
// run without optimization, without input
fn exec_bench_simple(
file: &Path,
executable_filename: &str,
expected_ending: &str,
bench_group_opt: Option<&mut BenchmarkGroup<WallTime>>,
) {
exec_bench_w_input(
file,
"",
executable_filename,
expected_ending,
true,
bench_group_opt,
)
}
fn exec_bench_w_input<T: Measurement>(
file: &Path,
stdin_str: &str,
executable_filename: &str,
expected_ending: &str,
run_optimized: bool,
bench_group_opt: Option<&mut BenchmarkGroup<T>>,
) {
let flags: &[&str] = if run_optimized { &["--optimize"] } else { &[] };
let flags: &[&str] = &["--optimize"];
let compile_out = run_roc(&[&["build", file.to_str().unwrap()], flags].concat());
@ -98,41 +80,44 @@ pub fn bench_nqueens<T: Measurement>(bench_group_opt: Option<&mut BenchmarkGroup
"11",
"nqueens",
"2680\n",
true,
bench_group_opt,
);
}
pub fn bench_cfold(bench_group_opt: Option<&mut BenchmarkGroup<WallTime>>) {
exec_bench_simple(
pub fn bench_cfold<T: Measurement>(bench_group_opt: Option<&mut BenchmarkGroup<T>>) {
exec_bench_w_input(
&example_file("benchmarks", "CFold.roc"),
"12",
"cfold",
"10426 & 10426\n",
bench_group_opt,
);
}
pub fn bench_deriv(bench_group_opt: Option<&mut BenchmarkGroup<WallTime>>) {
exec_bench_simple(
pub fn bench_deriv<T: Measurement>(bench_group_opt: Option<&mut BenchmarkGroup<T>>) {
exec_bench_w_input(
&example_file("benchmarks", "Deriv.roc"),
"7",
"deriv",
"1 count: 6\n2 count: 22\n3 count: 90\n4 count: 420\n5 count: 2202\n6 count: 12886\n7 count: 83648\n",
bench_group_opt,
);
}
pub fn bench_rbtree_ck(bench_group_opt: Option<&mut BenchmarkGroup<WallTime>>) {
exec_bench_simple(
pub fn bench_rbtree_ck<T: Measurement>(bench_group_opt: Option<&mut BenchmarkGroup<T>>) {
exec_bench_w_input(
&example_file("benchmarks", "RBTreeCk.roc"),
"5600",
"rbtree-ck",
"560\n",
bench_group_opt,
);
}
pub fn bench_rbtree_delete(bench_group_opt: Option<&mut BenchmarkGroup<WallTime>>) {
exec_bench_simple(
pub fn bench_rbtree_delete<T: Measurement>(bench_group_opt: Option<&mut BenchmarkGroup<T>>) {
exec_bench_w_input(
&example_file("benchmarks", "RBTreeDel.roc"),
"6000",
"rbtree-del",
"420\n",
bench_group_opt,

View file

@ -190,8 +190,9 @@ mod cli_run {
#[test]
#[serial(cfold)]
fn run_cfold_not_optimized() {
check_output(
check_output_with_stdin(
&example_file("benchmarks", "CFold.roc"),
"3",
"cfold",
&[],
"11 & 11\n",
@ -202,8 +203,9 @@ mod cli_run {
#[test]
#[serial(deriv)]
fn run_deriv_not_optimized() {
check_output(
check_output_with_stdin(
&example_file("benchmarks", "Deriv.roc"),
"2",
"deriv",
&[],
"1 count: 6\n2 count: 22\n",
@ -226,8 +228,9 @@ mod cli_run {
#[test]
#[serial(deriv)]
fn run_rbtree_delete_not_optimized() {
check_output(
check_output_with_stdin(
&example_file("benchmarks", "RBTreeDel.roc"),
"420",
"rbtree-del",
&[],
"30\n",

View file

@ -7,7 +7,8 @@ app "cfold"
main : Task.Task {} []
main =
e = mkExpr 12 1
Task.after Task.getInt \n ->
e = mkExpr n 1 # original koka n = 20 (set `ulimit -s unlimited` to avoid stack overflow for n = 20)
unoptimized = eval e
optimized = eval (constFolding (reassoc e))

View file

@ -9,13 +9,14 @@ IO a : Task.Task a []
main : IO {}
main =
Task.after Task.getInt \n ->
x : Expr
x = Var "x"
f : Expr
f = pow x x
nest deriv 7 f
nest deriv n f # original koka n = 10
|> Task.map (\_ -> {})
Expr : [ Val I64, Var Str, Add Expr Expr, Mul Expr Expr, Pow Expr Expr, Ln Expr ]

View file

@ -6,7 +6,7 @@ app "nqueens"
main : Task.Task {} []
main =
Task.after Task.getInt \n ->
queens n
queens n # original koka 13
|> Str.fromInt
|> Task.putLine

View file

@ -47,8 +47,9 @@ resultWithDefault = \res, default ->
main : Task.Task {} []
main =
Task.after Task.getInt \n ->
ms : ConsList Map
ms = makeMap 5 5600 # 4_200_000
ms = makeMap 5 n # original koka n = 4_200_000
when ms is
Cons head _ ->

View file

@ -14,8 +14,8 @@ ConsList a : [ Nil, Cons a (ConsList a) ]
main : Task.Task {} []
main =
# benchmarks use 4_200_000
m = makeMap 6000
Task.after Task.getInt \n ->
m = makeMap n # koka original n = 4_200_000
val = fold (\_, v, r -> if v then r + 1 else r) m 0