Merge branch 'trunk' into constrain_access

This commit is contained in:
Lucas 2021-05-23 16:24:48 -04:00 committed by GitHub
commit b942b78a34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 280 additions and 599 deletions

243
Cargo.lock generated
View file

@ -121,11 +121,11 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]] [[package]]
name = "ash" name = "ash"
version = "0.31.0" version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c69a8137596e84c22d57f3da1b5de1d4230b1742a710091c85f4d7ce50f00f38" checksum = "06063a002a77d2734631db74e8f4ce7148b77fe522e6bca46f2ae7774fd48112"
dependencies = [ dependencies = [
"libloading 0.6.7", "libloading 0.7.0",
] ]
[[package]] [[package]]
@ -263,7 +263,7 @@ checksum = "8e215f8c2f9f79cb53c8335e687ffd07d5bfcb6fe5fc80723762d0be46e7cc54"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -371,7 +371,7 @@ dependencies = [
"proc-macro-error", "proc-macro-error",
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -424,6 +424,16 @@ dependencies = [
"objc", "objc",
] ]
[[package]]
name = "codespan-reporting"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
dependencies = [
"termcolor",
"unicode-width",
]
[[package]] [[package]]
name = "colored" name = "colored"
version = "2.0.0" version = "2.0.0"
@ -758,17 +768,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d" checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d"
dependencies = [ dependencies = [
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
name = "d3d12" name = "d3d12"
version = "0.3.2" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0a60cceb22c7c53035f8980524fdc7f17cf49681a3c154e6757d30afbec6ec4" checksum = "091ed1b25fe47c7ff129fc440c23650b6114f36aa00bc7212cc8041879294428"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"libloading 0.6.7", "libloading 0.7.0",
"winapi 0.3.9", "winapi 0.3.9",
] ]
@ -793,7 +803,7 @@ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"strsim", "strsim",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -804,7 +814,7 @@ checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
dependencies = [ dependencies = [
"darling_core", "darling_core",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -815,7 +825,7 @@ checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -1071,7 +1081,7 @@ dependencies = [
"proc-macro-hack", "proc-macro-hack",
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -1148,9 +1158,9 @@ dependencies = [
[[package]] [[package]]
name = "gfx-auxil" name = "gfx-auxil"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7b33ecf067f2117668d91c9b0f2e5f223ebd1ffec314caa2f3de27bb580186d" checksum = "9ccf8711c9994dfa34337466bee3ae1462e172874c432ce4eb120ab2e98d39cf"
dependencies = [ dependencies = [
"fxhash", "fxhash",
"gfx-hal", "gfx-hal",
@ -1159,15 +1169,15 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx11" name = "gfx-backend-dx11"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f851d03c2e8f117e3702bf41201a4fafa447d5cb1276d5375870ae7573d069dd" checksum = "6f839f27f8c8a6dc553ccca7f5b35a42009432bc25db9688bba7061cd394161f"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
"gfx-auxil", "gfx-auxil",
"gfx-hal", "gfx-hal",
"libloading 0.6.7", "libloading 0.7.0",
"log", "log",
"parking_lot", "parking_lot",
"range-alloc", "range-alloc",
@ -1181,9 +1191,9 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx12" name = "gfx-backend-dx12"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36dc6ba2b7647e2c2b27b8f74ff5ccdd53c703776588eee5b1de515fdcbd6bc9" checksum = "3937738b0da5839bba4e33980d29f9a06dbce184d04a3a08c9a949e7953700e3"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
@ -1197,14 +1207,15 @@ dependencies = [
"raw-window-handle", "raw-window-handle",
"smallvec", "smallvec",
"spirv_cross", "spirv_cross",
"thunderdome",
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]] [[package]]
name = "gfx-backend-empty" name = "gfx-backend-empty"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f07ef26a65954cfdd7b4c587f485100d1bb3b0bd6a51b02d817d6c87cca7a91" checksum = "2ac55ada4bfcd35479b3421eea324d36d7da5f724e2f66ecb36d4efdb7041a5e"
dependencies = [ dependencies = [
"gfx-hal", "gfx-hal",
"log", "log",
@ -1213,32 +1224,31 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-gl" name = "gfx-backend-gl"
version = "0.7.1" version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6717c50ab601efe4a669bfb44db615e3888695ac8263222aeaa702642b9fbc2" checksum = "0caa03d6e0b7b4f202aea1f20c3f3288cfa06d92d24cea9d69c9a7627967244a"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
"gfx-auxil", "fxhash",
"gfx-hal", "gfx-hal",
"glow", "glow",
"js-sys", "js-sys",
"khronos-egl", "khronos-egl",
"libloading 0.6.7", "libloading 0.7.0",
"log", "log",
"naga", "naga",
"parking_lot", "parking_lot",
"raw-window-handle", "raw-window-handle",
"spirv_cross",
"wasm-bindgen", "wasm-bindgen",
"web-sys", "web-sys",
] ]
[[package]] [[package]]
name = "gfx-backend-metal" name = "gfx-backend-metal"
version = "0.7.0" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8dc54b456ece69ef49f8893269ebf24ac70969ed34ba2719c3f3abcc8fbff14e" checksum = "340895ad544ba46433acb3bdabece0ef16f2dbedc030adbd7c9eaf2839fbed41"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -1246,24 +1256,24 @@ dependencies = [
"cocoa-foundation", "cocoa-foundation",
"copyless", "copyless",
"foreign-types", "foreign-types",
"gfx-auxil", "fxhash",
"gfx-hal", "gfx-hal",
"log", "log",
"metal", "metal",
"naga", "naga",
"objc", "objc",
"parking_lot", "parking_lot",
"profiling",
"range-alloc", "range-alloc",
"raw-window-handle", "raw-window-handle",
"spirv_cross",
"storage-map", "storage-map",
] ]
[[package]] [[package]]
name = "gfx-backend-vulkan" name = "gfx-backend-vulkan"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dabe88b1a5c91e0f969b441cc57e70364858066e4ba937deeb62065654ef9bd9" checksum = "a353fc6fdb42ec646de49bbb74e4870e37a7e680caf33f3ac0615c30b1146d94"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"ash", "ash",
@ -1282,9 +1292,9 @@ dependencies = [
[[package]] [[package]]
name = "gfx-hal" name = "gfx-hal"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1d9cc8d3b573dda62d0baca4f02e0209786e22c562caff001d77c389008781d" checksum = "6d285bfd566f6b9134af908446ca350c0a1047495dfb9bbd826e701e8ee1d259"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"naga", "naga",
@ -1300,9 +1310,9 @@ checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce"
[[package]] [[package]]
name = "glow" name = "glow"
version = "0.7.2" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "072136d2c3783f3a92f131acb227bc806d3886278e2a4dc1e9990ec89ef9e70b" checksum = "4b80b98efaa8a34fce11d60dd2ce2760d5d83c373cbcc73bb87c2a3a84a54108"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"slotmap", "slotmap",
@ -1351,13 +1361,12 @@ dependencies = [
[[package]] [[package]]
name = "gpu-alloc" name = "gpu-alloc"
version = "0.3.0" version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e7724b9aef57ea36d70faf54e0ee6265f86e41de16bed8333efdeab5b00e16b" checksum = "bc76088804bb65a6f3b880bea9306fdaeffb25ebb453105fafa691282ee9fdba"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"gpu-alloc-types", "gpu-alloc-types",
"tracing",
] ]
[[package]] [[package]]
@ -1378,7 +1387,6 @@ dependencies = [
"bitflags", "bitflags",
"gpu-descriptor-types", "gpu-descriptor-types",
"hashbrown 0.9.1", "hashbrown 0.9.1",
"tracing",
] ]
[[package]] [[package]]
@ -1539,7 +1547,7 @@ dependencies = [
"proc-macro-hack", "proc-macro-hack",
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
"unindent", "unindent",
] ]
@ -1564,7 +1572,7 @@ source = "git+https://github.com/rtfeldman/inkwell?tag=llvm10-0.release4#9ae45f0
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -1638,9 +1646,9 @@ dependencies = [
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.46" version = "0.3.51"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062"
dependencies = [ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
@ -1657,12 +1665,12 @@ dependencies = [
[[package]] [[package]]
name = "khronos-egl" name = "khronos-egl"
version = "3.0.2" version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b19cc4a81304db2a0ad69740e83cdc3a9364e3f9bd6d88a87288a4c2deec927b" checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3"
dependencies = [ dependencies = [
"libc", "libc",
"libloading 0.6.7", "libloading 0.7.0",
] ]
[[package]] [[package]]
@ -1802,9 +1810,9 @@ dependencies = [
[[package]] [[package]]
name = "metal" name = "metal"
version = "0.21.0" version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4598d719460ade24c7d91f335daf055bf2a7eec030728ce751814c50cdd6a26c" checksum = "1c12e48c737ee9a55e8bb2352bcde588f79ae308d3529ee888f7cc0f469b5777"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"block", "block",
@ -1869,12 +1877,13 @@ dependencies = [
[[package]] [[package]]
name = "naga" name = "naga"
version = "0.3.2" version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05089b2acdf0e6a962cdbf5e328402345a27f59fcde1a59fe97a73e8149d416f" checksum = "f470a97eafcdd0dbea43d5e1a8ef3557aa31f49ba643d9430dbbf911c162b24c"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"bitflags", "bitflags",
"codespan-reporting",
"fxhash", "fxhash",
"log", "log",
"num-traits", "num-traits",
@ -1919,7 +1928,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -2030,7 +2039,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -2175,7 +2184,7 @@ checksum = "0b4b5f600e60dd3a147fb57b4547033d382d1979eb087af310e91cb45a63b1f4"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -2241,7 +2250,7 @@ dependencies = [
"pest_meta", "pest_meta",
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -2401,7 +2410,7 @@ dependencies = [
"proc-macro-error-attr", "proc-macro-error-attr",
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
"version_check", "version_check",
] ]
@ -2413,7 +2422,7 @@ checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
"syn-mid", "syn-mid",
"version_check", "version_check",
] ]
@ -2448,6 +2457,12 @@ dependencies = [
"unicode-xid 0.2.1", "unicode-xid 0.2.1",
] ]
[[package]]
name = "profiling"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3a66d5e88679f2720126c11ee29da07a08f094eac52306b066edd7d393752d6"
[[package]] [[package]]
name = "pulldown-cmark" name = "pulldown-cmark"
version = "0.8.0" version = "0.8.0"
@ -2501,7 +2516,7 @@ checksum = "b22a693222d716a9587786f37ac3f6b4faedb5b80c23914e7303ff5a1d8016e9"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -3405,7 +3420,7 @@ version = "0.3.1"
source = "git+https://github.com/rtfeldman/rustyline?tag=prompt-fix#a6b8a20d2bf5c3793d7367848be2f4afec2f0d99" source = "git+https://github.com/rtfeldman/rustyline?tag=prompt-fix#a6b8a20d2bf5c3793d7367848be2f4afec2f0d99"
dependencies = [ dependencies = [
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -3489,7 +3504,7 @@ checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -3534,7 +3549,7 @@ checksum = "b2acd6defeddb41eb60bb468f8825d0cfd0c2a76bc03bfd235b6a1dc4f6a1ad5"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -3641,7 +3656,7 @@ checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -3708,9 +3723,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.65" version = "1.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663" checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
@ -3725,7 +3740,7 @@ checksum = "baa8e7560a164edb1621a55d18a0c59abf49d360f47aa7b821061dd7eea7fac9"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -3736,7 +3751,7 @@ checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
"unicode-xid 0.2.1", "unicode-xid 0.2.1",
] ]
@ -3832,7 +3847,7 @@ checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
] ]
[[package]] [[package]]
@ -3848,9 +3863,9 @@ dependencies = [
[[package]] [[package]]
name = "thunderdome" name = "thunderdome"
version = "0.3.0" version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7572415bd688d401c52f6e36f4c8e805b9ae1622619303b9fa835d531db0acae" checksum = "87b4947742c93ece24a0032141d9caa3d853752e694a57e35029dd2bd08673e0"
[[package]] [[package]]
name = "tinytemplate" name = "tinytemplate"
@ -3885,38 +3900,6 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "tracing"
version = "0.1.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f"
dependencies = [
"cfg-if 1.0.0",
"pin-project-lite 0.2.6",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2"
dependencies = [
"proc-macro2 1.0.26",
"quote 1.0.9",
"syn 1.0.65",
]
[[package]]
name = "tracing-core"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f"
dependencies = [
"lazy_static",
]
[[package]] [[package]]
name = "ttf-parser" name = "ttf-parser"
version = "0.6.2" version = "0.6.2"
@ -4087,9 +4070,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.69" version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"wasm-bindgen-macro", "wasm-bindgen-macro",
@ -4097,24 +4080,24 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.69" version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"lazy_static", "lazy_static",
"log", "log",
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]] [[package]]
name = "wasm-bindgen-futures" name = "wasm-bindgen-futures"
version = "0.4.19" version = "0.4.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fe9756085a84584ee9457a002b7cdfe0bfff169f45d2591d8be1345a6780e35" checksum = "5fba7978c679d53ce2d0ac80c8c175840feb849a161664365d1287b41f2e67f1"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"js-sys", "js-sys",
@ -4124,9 +4107,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.69" version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4"
dependencies = [ dependencies = [
"quote 1.0.9", "quote 1.0.9",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@ -4134,22 +4117,22 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.69" version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"quote 1.0.9", "quote 1.0.9",
"syn 1.0.65", "syn 1.0.72",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.69" version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f"
[[package]] [[package]]
name = "wasmparser" name = "wasmparser"
@ -4232,9 +4215,9 @@ dependencies = [
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.46" version = "0.3.50"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" checksum = "a905d57e488fec8861446d3393670fb50d27a262344013181c2cdf9fff5481be"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@ -4242,18 +4225,17 @@ dependencies = [
[[package]] [[package]]
name = "wgpu" name = "wgpu"
version = "0.7.1" version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79a0a0a63fac9492cfaf6e7e4bdf9729c128f1e94124b9e4cbc4004b8cb6d1d8" checksum = "215fd50e66f794bd16683e7e0e0b9b53be265eb10fdf02276caf5de3e5743fcf"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"js-sys", "js-sys",
"log",
"naga", "naga",
"parking_lot", "parking_lot",
"raw-window-handle", "raw-window-handle",
"smallvec", "smallvec",
"syn 1.0.65",
"tracing",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures", "wasm-bindgen-futures",
"web-sys", "web-sys",
@ -4263,9 +4245,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core" name = "wgpu-core"
version = "0.7.1" version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c89fa2cc5d72236461ac09c5be967012663e29cb62f1a972654cbf35e49dffa8" checksum = "1d56c368fc0e6f3927c711d2b55a51ad4321218efc0239c4acf69e456ab70399"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -4281,29 +4263,30 @@ dependencies = [
"gfx-hal", "gfx-hal",
"gpu-alloc", "gpu-alloc",
"gpu-descriptor", "gpu-descriptor",
"log",
"naga", "naga",
"parking_lot", "parking_lot",
"profiling",
"raw-window-handle", "raw-window-handle",
"smallvec", "smallvec",
"thiserror", "thiserror",
"tracing",
"wgpu-types", "wgpu-types",
] ]
[[package]] [[package]]
name = "wgpu-types" name = "wgpu-types"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72fa9ba80626278fd87351555c363378d08122d7601e58319be3d6fa85a87747" checksum = "aa248d90c8e6832269b8955bf800e8241f942c25e18a235b7752226804d21556"
dependencies = [ dependencies = [
"bitflags", "bitflags",
] ]
[[package]] [[package]]
name = "wgpu_glyph" name = "wgpu_glyph"
version = "0.11.0" version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "354c1f79e09923724a6006a6953c3946522b84f7a9ec202b7e8001f274fd4bd5" checksum = "634570b440f4c24c2e6049ed01ec832c23d338dea3eca654d5760838017a1c8b"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"glyph_brush", "glyph_brush",
@ -4497,6 +4480,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d498dbd1fd7beb83c86709ae1c33ca50942889473473d287d56ce4770a18edfb" checksum = "d498dbd1fd7beb83c86709ae1c33ca50942889473473d287d56ce4770a18edfb"
dependencies = [ dependencies = [
"proc-macro2 1.0.26", "proc-macro2 1.0.26",
"syn 1.0.65", "syn 1.0.72",
"synstructure", "synstructure",
] ]

View file

@ -665,6 +665,42 @@ pub fn listAppend(list: RocList, alignment: usize, element: Opaque, element_widt
return output; return output;
} }
pub fn listDrop(
list: RocList,
alignment: usize,
element_width: usize,
drop_count: usize,
dec: Dec,
) callconv(.C) RocList {
if (list.bytes) |source_ptr| {
const size = list.len();
const keep_count = size - drop_count;
var i: usize = 0;
const iterations = std.math.min(drop_count, size);
while (i < iterations) : (i += 1) {
const element = source_ptr + i * element_width;
dec(element);
}
if (drop_count >= size) {
return RocList.empty();
}
const output = RocList.allocate(std.heap.c_allocator, alignment, keep_count, element_width);
const target_ptr = output.bytes orelse unreachable;
@memcpy(target_ptr, source_ptr + drop_count * element_width, keep_count * element_width);
utils.decref(std.heap.c_allocator, alignment, list.bytes, size * element_width);
return output;
} else {
return RocList.empty();
}
}
pub fn listRange(width: utils.IntWidth, low: Opaque, high: Opaque) callconv(.C) RocList { pub fn listRange(width: utils.IntWidth, low: Opaque, high: Opaque) callconv(.C) RocList {
const allocator = std.heap.c_allocator; const allocator = std.heap.c_allocator;
const IntWidth = utils.IntWidth; const IntWidth = utils.IntWidth;

View file

@ -25,6 +25,7 @@ comptime {
exportListFn(list.listReverse, "reverse"); exportListFn(list.listReverse, "reverse");
exportListFn(list.listSortWith, "sort_with"); exportListFn(list.listSortWith, "sort_with");
exportListFn(list.listConcat, "concat"); exportListFn(list.listConcat, "concat");
exportListFn(list.listDrop, "drop");
} }
// Dict Module // Dict Module

View file

@ -76,6 +76,7 @@ pub const LIST_WALK_BACKWARDS: &str = "roc_builtins.list.walk_backwards";
pub const LIST_CONTAINS: &str = "roc_builtins.list.contains"; pub const LIST_CONTAINS: &str = "roc_builtins.list.contains";
pub const LIST_REPEAT: &str = "roc_builtins.list.repeat"; pub const LIST_REPEAT: &str = "roc_builtins.list.repeat";
pub const LIST_APPEND: &str = "roc_builtins.list.append"; pub const LIST_APPEND: &str = "roc_builtins.list.append";
pub const LIST_DROP: &str = "roc_builtins.list.drop";
pub const LIST_SINGLE: &str = "roc_builtins.list.single"; pub const LIST_SINGLE: &str = "roc_builtins.list.single";
pub const LIST_JOIN: &str = "roc_builtins.list.join"; pub const LIST_JOIN: &str = "roc_builtins.list.join";
pub const LIST_RANGE: &str = "roc_builtins.list.range"; pub const LIST_RANGE: &str = "roc_builtins.list.range";

View file

@ -848,6 +848,13 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
Box::new(list_type(flex(TVAR1))), Box::new(list_type(flex(TVAR1))),
); );
// drop : List elem, Nat -> List elem
add_top_level_function_type!(
Symbol::LIST_DROP,
vec![list_type(flex(TVAR1)), nat_type()],
Box::new(list_type(flex(TVAR1))),
);
// prepend : List elem, elem -> List elem // prepend : List elem, elem -> List elem
add_top_level_function_type!( add_top_level_function_type!(
Symbol::LIST_PREPEND, Symbol::LIST_PREPEND,

View file

@ -84,6 +84,7 @@ pub fn builtin_defs_map(symbol: Symbol, var_store: &mut VarStore) -> Option<Def>
LIST_MAP => list_map, LIST_MAP => list_map,
LIST_MAP2 => list_map2, LIST_MAP2 => list_map2,
LIST_MAP3 => list_map3, LIST_MAP3 => list_map3,
LIST_DROP => list_drop,
LIST_MAP_WITH_INDEX => list_map_with_index, LIST_MAP_WITH_INDEX => list_map_with_index,
LIST_KEEP_IF => list_keep_if, LIST_KEEP_IF => list_keep_if,
LIST_KEEP_OKS => list_keep_oks, LIST_KEEP_OKS => list_keep_oks,
@ -1881,6 +1882,28 @@ fn list_set(symbol: Symbol, var_store: &mut VarStore) -> Def {
list_ret_var, list_ret_var,
) )
} }
/// List.drop : List elem, Nat -> List elem
fn list_drop(symbol: Symbol, var_store: &mut VarStore) -> Def {
let list_var = var_store.fresh();
let index_var = var_store.fresh();
let body = RunLowLevel {
op: LowLevel::ListDrop,
args: vec![
(list_var, Var(Symbol::ARG_1)),
(index_var, Var(Symbol::ARG_2)),
],
ret_var: list_var,
};
defn(
symbol,
vec![(list_var, Symbol::ARG_1), (index_var, Symbol::ARG_2)],
var_store,
body,
list_var,
)
}
/// List.append : List elem, elem -> List elem /// List.append : List elem, elem -> List elem
fn list_append(symbol: Symbol, var_store: &mut VarStore) -> Def { fn list_append(symbol: Symbol, var_store: &mut VarStore) -> Def {

View file

@ -6,9 +6,9 @@ use crate::llvm::build_dict::{
use crate::llvm::build_hash::generic_hash; use crate::llvm::build_hash::generic_hash;
use crate::llvm::build_list::{ use crate::llvm::build_list::{
allocate_list, empty_list, empty_polymorphic_list, list_append, list_concat, list_contains, allocate_list, empty_list, empty_polymorphic_list, list_append, list_concat, list_contains,
list_get_unsafe, list_join, list_keep_errs, list_keep_if, list_keep_oks, list_len, list_map, list_drop, list_get_unsafe, list_join, list_keep_errs, list_keep_if, list_keep_oks, list_len,
list_map2, list_map3, list_map_with_index, list_prepend, list_range, list_repeat, list_reverse, list_map, list_map2, list_map3, list_map_with_index, list_prepend, list_range, list_repeat,
list_set, list_single, list_sort_with, list_walk_help, list_reverse, list_set, list_single, list_sort_with, list_walk_help,
}; };
use crate::llvm::build_str::{ use crate::llvm::build_str::{
empty_str, str_concat, str_count_graphemes, str_ends_with, str_from_float, str_from_int, empty_str, str_concat, str_count_graphemes, str_ends_with, str_from_float, str_from_int,
@ -3883,6 +3883,27 @@ fn run_low_level<'a, 'ctx, 'env>(
list_append(env, inplace, original_wrapper, elem, elem_layout) list_append(env, inplace, original_wrapper, elem, elem_layout)
} }
ListDrop => {
// List.drop : List elem, Nat -> List elem
debug_assert_eq!(args.len(), 2);
let (list, list_layout) = load_symbol_and_layout(scope, &args[0]);
let original_wrapper = list.into_struct_value();
let count = load_symbol(scope, &args[1]);
match list_layout {
Layout::Builtin(Builtin::EmptyList) => empty_list(env),
Layout::Builtin(Builtin::List(_, element_layout)) => list_drop(
env,
layout_ids,
original_wrapper,
count.into_int_value(),
element_layout,
),
_ => unreachable!("Invalid layout {:?} in List.drop", list_layout),
}
}
ListPrepend => { ListPrepend => {
// List.prepend : List elem, elem -> List elem // List.prepend : List elem, elem -> List elem
debug_assert_eq!(args.len(), 2); debug_assert_eq!(args.len(), 2);

View file

@ -322,6 +322,28 @@ pub fn list_append<'a, 'ctx, 'env>(
) )
} }
/// List.drop : List elem, Nat -> List elem
pub fn list_drop<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
layout_ids: &mut LayoutIds<'a>,
original_wrapper: StructValue<'ctx>,
count: IntValue<'ctx>,
element_layout: &Layout<'a>,
) -> BasicValueEnum<'ctx> {
let dec_element_fn = build_dec_wrapper(env, layout_ids, &element_layout);
call_bitcode_fn_returns_list(
env,
&[
pass_list_as_i128(env, original_wrapper.into()),
alignment_intvalue(env, &element_layout),
layout_width(env, &element_layout),
count.into(),
dec_element_fn.as_global_value().as_pointer_value().into(),
],
&bitcode::LIST_DROP,
)
}
/// List.set : List elem, Int, elem -> List elem /// List.set : List elem, Int, elem -> List elem
pub fn list_set<'a, 'ctx, 'env>( pub fn list_set<'a, 'ctx, 'env>(
parent: FunctionValue<'ctx>, parent: FunctionValue<'ctx>,

View file

@ -128,9 +128,7 @@ mod gen_num {
af = 31 af = 31
ag = 32 ag = 32
# This can't be one line because it causes a stack overflow in the frontend :( a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s + t + u + v + w + x + y + z + aa + ab + ac + ad + ae + af + ag
tmp = a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q
tmp + r + s + t + u + v + w + x + y + z + aa + ab + ac + ad + ae + af + ag
"# "#
), ),
528, 528,

View file

@ -51,7 +51,7 @@ const DEFAULT_APP_OUTPUT_PATH: &str = "app";
const ROC_FILE_EXTENSION: &str = "roc"; const ROC_FILE_EXTENSION: &str = "roc";
/// Roc-Config file name /// Roc-Config file name
const PKG_CONFIG_FILE_NAME: &str = "Pkg-Config"; const PKG_CONFIG_FILE_NAME: &str = "Package-Config";
/// The . in between module names like Foo.Bar.Baz /// The . in between module names like Foo.Bar.Baz
const MODULE_SEPARATOR: char = '.'; const MODULE_SEPARATOR: char = '.';
@ -1892,7 +1892,7 @@ fn update<'a>(
let work = state.dependencies.notify(module_id, Phase::SolveTypes); let work = state.dependencies.notify(module_id, Phase::SolveTypes);
// if there is a platform, the Pkg-Config module provides host-exposed, // if there is a platform, the Package-Config module provides host-exposed,
// otherwise the App module exposes host-exposed // otherwise the App module exposes host-exposed
let is_host_exposed = match state.platform_id { let is_host_exposed = match state.platform_id {
None => module_id == state.root_id, None => module_id == state.root_id,
@ -2312,7 +2312,7 @@ fn load_pkg_config<'a>(
let chomped = &bytes[..delta]; let chomped = &bytes[..delta];
let header_src = unsafe { std::str::from_utf8_unchecked(chomped) }; let header_src = unsafe { std::str::from_utf8_unchecked(chomped) };
// make a Pkg-Config module that ultimately exposes `main` to the host // make a Package-Config module that ultimately exposes `main` to the host
let pkg_config_module_msg = fabricate_pkg_config_module( let pkg_config_module_msg = fabricate_pkg_config_module(
arena, arena,
shorthand, shorthand,
@ -2551,7 +2551,7 @@ fn parse_header<'a>(
}) => { }) => {
match package_or_path { match package_or_path {
PackageOrPath::Path(StrLiteral::PlainLine(package)) => { PackageOrPath::Path(StrLiteral::PlainLine(package)) => {
// check whether we can find a Pkg-Config.roc file // check whether we can find a Package-Config.roc file
let mut pkg_config_roc = pkg_config_dir; let mut pkg_config_roc = pkg_config_dir;
pkg_config_roc.push(package); pkg_config_roc.push(package);
pkg_config_roc.push(PKG_CONFIG_FILE_NAME); pkg_config_roc.push(PKG_CONFIG_FILE_NAME);

View file

@ -39,6 +39,7 @@ pub enum LowLevel {
ListKeepOks, ListKeepOks,
ListKeepErrs, ListKeepErrs,
ListSortWith, ListSortWith,
ListDrop,
DictSize, DictSize,
DictEmpty, DictEmpty,
DictInsert, DictInsert,

View file

@ -924,6 +924,7 @@ define_builtins! {
29 LIST_WALK_UNTIL: "walkUntil" 29 LIST_WALK_UNTIL: "walkUntil"
30 LIST_RANGE: "range" 30 LIST_RANGE: "range"
31 LIST_SORT_WITH: "sortWith" 31 LIST_SORT_WITH: "sortWith"
32 LIST_DROP: "drop"
} }
5 RESULT: "Result" => { 5 RESULT: "Result" => {
0 RESULT_RESULT: "Result" imported // the Result.Result type alias 0 RESULT_RESULT: "Result" imported // the Result.Result type alias

View file

@ -665,6 +665,7 @@ pub fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[bool] {
// TODO when we have lists with capacity (if ever) // TODO when we have lists with capacity (if ever)
// List.append should own its first argument // List.append should own its first argument
ListAppend => arena.alloc_slice_copy(&[owned, owned]), ListAppend => arena.alloc_slice_copy(&[owned, owned]),
ListDrop => arena.alloc_slice_copy(&[owned, irrelevant]),
Eq | NotEq => arena.alloc_slice_copy(&[borrowed, borrowed]), Eq | NotEq => arena.alloc_slice_copy(&[borrowed, borrowed]),

View file

@ -147,6 +147,17 @@ fn list_append() {
); );
} }
#[test]
fn list_drop() {
assert_evals_to!(
"List.drop [1,2,3] 2",
RocList::from_slice(&[3]),
RocList<i64>
);
assert_evals_to!("List.drop [] 1", RocList::from_slice(&[]), RocList<i64>);
assert_evals_to!("List.drop [1,2] 5", RocList::from_slice(&[]), RocList<i64>);
}
#[test] #[test]
fn list_append_to_empty_list() { fn list_append_to_empty_list() {
assert_evals_to!("List.append [] 3", RocList::from_slice(&[3]), RocList<i64>); assert_evals_to!("List.append [] 3", RocList::from_slice(&[3]), RocList<i64>);

View file

@ -28,13 +28,13 @@ arraystring = "0.3.0"
libc = "0.2" libc = "0.2"
page_size = "0.4" page_size = "0.4"
winit = "0.24" winit = "0.24"
wgpu = "0.7" wgpu = "0.8"
glyph_brush = "0.7" glyph_brush = "0.7"
log = "0.4" log = "0.4"
zerocopy = "0.3" zerocopy = "0.3"
env_logger = "0.8" env_logger = "0.8"
futures = "0.3" futures = "0.3"
wgpu_glyph = "0.11" wgpu_glyph = "0.12"
cgmath = "0.18.0" cgmath = "0.18.0"
snafu = { version = "0.6", features = ["backtraces"] } snafu = { version = "0.6", features = ["backtraces"] }
colored = "2" colored = "2"
@ -62,11 +62,3 @@ quickcheck = "1.0"
quickcheck_macros = "1.0" quickcheck_macros = "1.0"
criterion = "0.3" criterion = "0.3"
rand = "0.8.2" rand = "0.8.2"
[[bench]]
name = "file_benchmark"
harness = false
[[bench]]
name = "edit_benchmark"
harness = false

View file

@ -1,216 +0,0 @@
use bumpalo::Bump;
use criterion::{criterion_group, criterion_main, Criterion};
use rand::rngs::StdRng;
use rand::{Rng, SeedableRng};
use roc_editor::mvc::app_model::AppModel;
use roc_editor::mvc::ed_model::{EdModel, Position, RawSelection};
use roc_editor::mvc::update::handle_new_char;
use roc_editor::text_buffer;
use roc_editor::text_buffer::TextBuffer;
use ropey::Rope;
use std::cmp::min;
use std::path::Path;
// duplicate inside mvc::update
fn mock_app_model(
text_buf: TextBuffer,
caret_pos: Position,
selection_opt: Option<RawSelection>,
) -> AppModel {
AppModel {
ed_model_opt: Some(EdModel {
text_buf,
caret_pos,
selection_opt,
glyph_dim_rect_opt: None,
has_focus: true,
}),
}
}
fn text_buffer_from_str(lines_str: &str) -> TextBuffer {
TextBuffer {
text_rope: Rope::from_str(lines_str),
path_str: "".to_owned(),
arena: Bump::new(),
}
}
pub fn char_insert_bench(c: &mut Criterion) {
let text_buf = text_buffer_from_str("");
let caret_pos = Position { line: 0, column: 0 };
let selection_opt: Option<RawSelection> = None;
let mut app_model = mock_app_model(text_buf, caret_pos, selection_opt);
c.bench_function("single char insert, small buffer", |b| {
b.iter(|| handle_new_char(&mut app_model, &'a'))
});
}
fn bench_resource_path(nr_lines: usize) -> String {
let resource_path_res = std::env::var("BENCH_RESOURCE_PATH");
let resource_path_str = if let Ok(resource_path) = resource_path_res {
resource_path
} else {
"benches/resources/".to_owned()
};
format!("{}{}_lines.roc", resource_path_str, nr_lines)
}
pub fn char_pop_bench(c: &mut Criterion) {
let nr_lines = 50000;
let mut text_buf = buf_from_dummy_file(nr_lines);
let mut rand_gen_pos = StdRng::seed_from_u64(44);
c.bench_function(
&format!("single char pop, {} lines", text_buf.nr_of_lines()),
|b| {
b.iter(|| {
let max_line_nr = text_buf.nr_of_lines();
let rand_line_nr = rand_gen_pos.gen_range(0..max_line_nr);
let max_col = text_buf
.line_len(rand_line_nr)
.expect("Failed to retrieve line length.");
let caret_pos = Position {
line: rand_line_nr,
column: rand_gen_pos.gen_range(0..max_col),
};
text_buf.pop_char(caret_pos);
})
},
);
}
fn get_all_lines_helper(nr_lines: usize, c: &mut Criterion) {
let text_buf = buf_from_dummy_file(nr_lines);
let arena = Bump::new();
c.bench_function(
&format!("get all {:?} lines from textbuffer", nr_lines),
|b| b.iter(|| text_buf.all_lines(&arena)),
);
}
fn get_all_lines_bench(c: &mut Criterion) {
get_all_lines_helper(10000, c)
}
fn get_line_len_helper(nr_lines: usize, c: &mut Criterion) {
let text_buf = buf_from_dummy_file(nr_lines);
let mut rand_gen = StdRng::seed_from_u64(45);
c.bench_function(
&format!("get random line len from {:?}-line textbuffer", nr_lines),
|b| b.iter(|| text_buf.line_len(rand_gen.gen_range(0..nr_lines)).unwrap()),
);
}
fn get_line_len_bench(c: &mut Criterion) {
get_line_len_helper(10000, c)
}
fn get_line_helper(nr_lines: usize, c: &mut Criterion) {
let text_buf = buf_from_dummy_file(nr_lines);
let mut rand_gen = StdRng::seed_from_u64(46);
c.bench_function(
&format!("get random line from {:?}-line textbuffer", nr_lines),
|b| {
b.iter(|| {
let rand_indx = rand_gen.gen_range(0..nr_lines);
text_buf.line(rand_indx).unwrap()
})
},
);
}
fn get_line_bench(c: &mut Criterion) {
get_line_helper(10000, c)
}
pub fn del_select_bench(c: &mut Criterion) {
let nr_lines = 25000000;
let mut text_buf = buf_from_dummy_file(nr_lines);
let mut rand_gen = StdRng::seed_from_u64(47);
c.bench_function(
&format!(
"delete rand selection, {}-line file",
text_buf.nr_of_lines()
),
|b| {
b.iter(|| {
let rand_sel = gen_rand_selection(&mut rand_gen, &text_buf);
text_buf.del_selection(rand_sel).unwrap();
})
},
);
}
fn gen_rand_selection(rand_gen: &mut StdRng, text_buf: &TextBuffer) -> RawSelection {
let max_line_nr = text_buf.nr_of_lines();
let rand_line_nr_a = rand_gen.gen_range(0..max_line_nr - 3);
let max_col_a = text_buf.line_len(rand_line_nr_a).expect(&format!(
"Failed to retrieve line length. For line {}, with {} lines in buffer",
rand_line_nr_a,
text_buf.nr_of_lines()
));
let rand_col_a = if max_col_a > 0 {
rand_gen.gen_range(0..max_col_a)
} else {
0
};
let max_sel_end = min(rand_line_nr_a + 5, max_line_nr);
let rand_line_nr_b = rand_gen.gen_range((rand_line_nr_a + 1)..max_sel_end);
let max_col_b = text_buf.line_len(rand_line_nr_b).expect(&format!(
"Failed to retrieve line length. For line {}, with {} lines in buffer",
rand_line_nr_b,
text_buf.nr_of_lines()
));
let rand_col_b = if max_col_b > 0 {
rand_gen.gen_range(0..max_col_b)
} else {
0
};
RawSelection {
start_pos: Position {
line: rand_line_nr_a,
column: rand_col_a,
},
end_pos: Position {
line: rand_line_nr_b,
column: rand_col_b,
},
}
}
fn buf_from_dummy_file(nr_lines: usize) -> TextBuffer {
let path_str = bench_resource_path(nr_lines);
text_buffer::from_path(Path::new(&path_str)).expect("Failed to read file at given path.")
}
//TODO remove all random generation from inside measured execution block
//criterion_group!(benches, del_select_bench);
criterion_group!(
benches,
char_pop_bench,
char_insert_bench,
get_all_lines_bench,
get_line_len_bench,
get_line_bench,
del_select_bench
);
criterion_main!(benches);

View file

@ -1,163 +0,0 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use rand::distributions::Alphanumeric;
use rand::rngs::StdRng;
use rand::{Rng, SeedableRng};
use roc_editor::mvc::app_model::AppModel;
use roc_editor::mvc::ed_model::{EdModel, Position, RawSelection};
use roc_editor::mvc::update::handle_new_char;
use roc_editor::text_buffer;
use roc_editor::text_buffer::TextBuffer;
use ropey::Rope;
use std::fs::File;
use std::io::Write;
use std::path::Path;
// duplicate inside mvc::update
fn mock_app_model(
text_buf: TextBuffer,
caret_pos: Position,
selection_opt: Option<RawSelection>,
) -> AppModel {
AppModel {
ed_model_opt: Some(EdModel {
text_buf,
caret_pos,
selection_opt,
glyph_dim_rect_opt: None,
has_focus: true,
}),
}
}
fn text_buffer_from_str(lines_str: &str) -> TextBuffer {
TextBuffer {
text_rope: Rope::from_str(lines_str),
path_str: "".to_owned(),
arena: bumpalo::Bump::new(),
}
}
pub fn char_insert_benchmark(c: &mut Criterion) {
let text_buf = text_buffer_from_str("");
let caret_pos = Position { line: 0, column: 0 };
let selection_opt: Option<RawSelection> = None;
let mut app_model = mock_app_model(text_buf, caret_pos, selection_opt);
c.bench_function("single char insert, small buffer", |b| {
b.iter(|| handle_new_char(&mut app_model, &'a'))
});
}
static ROC_SOURCE_START: &str = "interface LongStrProvider
exposes [ longStr ]
imports []
longStr : Str
longStr =
\"\"\"";
static ROC_SOURCE_END: &str = "\"\"\"";
fn line_count(lines: &str) -> usize {
lines.matches("\n").count()
}
pub fn gen_file(nr_lines: usize) {
let nr_of_str_lines = nr_lines - line_count(ROC_SOURCE_START);
let path_str = bench_resource_path(nr_lines);
let path = Path::new(&path_str);
let display = path.display();
// Open a file in write-only mode, returns `io::Result<File>`
let mut file = match File::create(&path) {
Err(why) => panic!("couldn't create {}: {}", display, why),
Ok(file) => file,
};
file.write(ROC_SOURCE_START.as_bytes())
.expect("Failed to write String to file.");
let mut rand_gen_line = StdRng::seed_from_u64(42);
for _ in 0..nr_of_str_lines {
let line_len = rand_gen_line.gen_range(1..90);
let char_seed = rand_gen_line.gen_range(0..1000);
let mut rand_string: String = StdRng::seed_from_u64(char_seed)
.sample_iter(&Alphanumeric)
.take(line_len)
.map(char::from)
.collect();
rand_string.push('\n');
file.write(rand_string.as_bytes())
.expect("Failed to write String to file.");
}
file.write(ROC_SOURCE_END.as_bytes())
.expect("Failed to write String to file.");
}
fn bench_resource_path(nr_lines: usize) -> String {
let resource_path_res = std::env::var("BENCH_RESOURCE_PATH");
let resource_path_str = if let Ok(resource_path) = resource_path_res {
resource_path
} else {
"benches/resources/".to_owned()
};
format!("{}{}_lines.roc", resource_path_str, nr_lines)
}
fn file_read_bench_helper(nr_lines: usize, c: &mut Criterion) {
let path_str = bench_resource_path(nr_lines);
text_buffer::from_path(Path::new(&path_str)).expect("Failed to read file at given path.");
c.bench_function(
&format!("read {:?} line file into textbuffer", nr_lines),
|b| b.iter(|| text_buffer::from_path(black_box(Path::new(&path_str)))),
);
}
fn file_read_bench_10(c: &mut Criterion) {
// generate dummy files
/*let lines_vec = vec![100, 500, 1000, 10000, 50000, 100000, 25000000];
for nr_lines in lines_vec.iter(){
gen_file(*nr_lines);
}*/
file_read_bench_helper(10, c)
}
fn file_read_bench_100(c: &mut Criterion) {
file_read_bench_helper(100, c)
}
fn file_read_bench_500(c: &mut Criterion) {
file_read_bench_helper(500, c)
}
fn file_read_bench_1k(c: &mut Criterion) {
file_read_bench_helper(1000, c)
}
fn file_read_bench_10k(c: &mut Criterion) {
file_read_bench_helper(10000, c)
}
fn file_read_bench_100k(c: &mut Criterion) {
file_read_bench_helper(100000, c)
}
fn file_read_bench_25m(c: &mut Criterion) {
file_read_bench_helper(25000000, c)
}
criterion_group!(
benches,
file_read_bench_10,
file_read_bench_100,
file_read_bench_500,
file_read_bench_1k,
file_read_bench_10k,
file_read_bench_100k,
file_read_bench_25m
);
criterion_main!(benches);

View file

@ -1,11 +0,0 @@
interface LongStrProvider
exposes [ longStr ]
imports []
longStr : Str
longStr =
"""7vntt4wlBKiVkNss19DZlOfmSAyIzO5Ph8eckYgnctYDersOFs3AWOPHcONxI58DoTEwGKNLGkhrxwCD
gWxYsX9hlEuQ0vI4twHMqgj8F
Ox4pVYIxku15v1KaWahgjkJ8EBXMWhe5m2519wpEtP
HtaqU0XzVu1ix3jGAZ66UugNKJrVP8RVQm
"""

View file

@ -1,26 +0,0 @@
System info:
- CPU: Intel i7 4770k
- SSD: Samsung 970 EVO PLUS M.2 1TB
- OS: Ubuntu 20.04
c.bench_function(
"read file into textbuffer",
|b| b.iter(|| text_buffer::from_path(black_box(Path::new(path_str))))
);
10 lines, 285 B time: [3.2343 us]
100 lines, 4.2 KiB time: [6.1810 us]
500 lines, 22.2 KiB time: [15.689 us]
1000 lines, 44.6 KiB time: [29.591 us]
10000 lines, 448 KiB time: [376.22 us]
50000 lines, 2.2 MiB time: [2.0329 ms]
100000 lines, 4.4 MiB time: [4.4221 ms]
25000000 lines, 1.1 GiB time: [1.1333 s]

View file

@ -396,8 +396,8 @@ fn begin_render_pass<'a>(
let bg_color = to_wgpu_color(ed_theme.background); let bg_color = to_wgpu_color(ed_theme.background);
encoder.begin_render_pass(&wgpu::RenderPassDescriptor { encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { color_attachments: &[wgpu::RenderPassColorAttachment {
attachment: texture_view, view: texture_view,
resolve_target: None, resolve_target: None,
ops: wgpu::Operations { ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(bg_color), load: wgpu::LoadOp::Clear(bg_color),

View file

@ -53,12 +53,14 @@ pub fn create_render_pipeline(
entry_point: "fs_main", entry_point: "fs_main",
targets: &[wgpu::ColorTargetState { targets: &[wgpu::ColorTargetState {
format: color_format, format: color_format,
color_blend: wgpu::BlendState { blend: Some(wgpu::BlendState {
color: wgpu::BlendComponent {
operation: wgpu::BlendOperation::Add, operation: wgpu::BlendOperation::Add,
src_factor: wgpu::BlendFactor::SrcAlpha, src_factor: wgpu::BlendFactor::SrcAlpha,
dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha, dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
}, },
alpha_blend: wgpu::BlendState::REPLACE, alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL, write_mask: wgpu::ColorWrite::ALL,
}], }],
}), }),

View file

@ -24,13 +24,13 @@ impl Vertex {
wgpu::VertexAttribute { wgpu::VertexAttribute {
offset: 0, offset: 0,
shader_location: 0, shader_location: 0,
format: wgpu::VertexFormat::Float2, format: wgpu::VertexFormat::Float32x2,
}, },
// color // color
wgpu::VertexAttribute { wgpu::VertexAttribute {
offset: std::mem::size_of::<[f32; 2]>() as wgpu::BufferAddress, offset: std::mem::size_of::<[f32; 2]>() as wgpu::BufferAddress,
shader_location: 1, shader_location: 1,
format: wgpu::VertexFormat::Float4, format: wgpu::VertexFormat::Float32x4,
}, },
], ],
}; };

View file

@ -1,12 +1,8 @@
[[location(0)]] struct VertexOutput {
var<in> in_position: vec2<f32>; [[location(0)]] color: vec4<f32>;
[[location(1)]] [[builtin(position)]] position: vec4<f32>;
var<in> in_color: vec4<f32>; };
[[location(0)]]
var<out> out_color: vec4<f32>;
[[builtin(position)]]
var<out> out_pos: vec4<f32>;
[[block]] [[block]]
struct Globals { struct Globals {
@ -17,17 +13,19 @@ struct Globals {
var<uniform> u_globals: Globals; var<uniform> u_globals: Globals;
[[stage(vertex)]] [[stage(vertex)]]
fn vs_main() { fn vs_main(
out_pos = u_globals.ortho * vec4<f32>(in_position, 0.0, 1.0); [[location(0)]] in_position: vec2<f32>,
out_color = in_color; [[location(1)]] in_color: vec4<f32>,
} ) -> VertexOutput {
var out: VertexOutput;
[[location(0)]] out.position = u_globals.ortho * vec4<f32>(in_position, 0.0, 1.0);
var<in> in_color: vec4<f32>; out.color = in_color;
[[location(0)]]
var<out> out_color: vec4<f32>; return out;
}
[[stage(fragment)]] [[stage(fragment)]]
fn fs_main() { fn fs_main(in: VertexOutput) -> [[location(0)]] vec4<f32> {
out_color = in_color; return in.color;
} }

View file

@ -13,4 +13,3 @@ platform examples/shared-quicksort
mainForHost : List I64 -> List I64 mainForHost : List I64 -> List I64
mainForHost = \list -> quicksort list mainForHost = \list -> quicksort list