-
Notifications
You must be signed in to change notification settings - Fork 24
unic-ucd-name takes a long time to compile (nightly) #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I modified the name tables to use Time Passes
diffdiff --git a/gen/src/writer/ucd/name.rs b/gen/src/writer/ucd/name.rs
index 180ee9b..cd8484c 100644
--- a/gen/src/writer/ucd/name.rs
+++ b/gen/src/writer/ucd/name.rs
@@ -47,7 +47,7 @@ fn emit_name_tables(dir: &Path) {
for piece in values.iter() {
writeln!(
values_contents,
- "const {}: &str = \"{}\";",
+ "static {}: &str = \"{}\";",
piece.replace('-', "_"),
piece
).unwrap();
@@ -64,7 +64,7 @@ fn emit_name_tables(dir: &Path) {
record
.pieces
.iter()
- .map(|s| s.replace('-', "_"))
+ .map(|s| format!("&{}", s.replace('-', "_")))
.collect::<Vec<_>>()
.join(", ")
)
diff --git a/unic/ucd/name/src/name.rs b/unic/ucd/name/src/name.rs
index 05ea96f..5d249c0 100644
--- a/unic/ucd/name/src/name.rs
+++ b/unic/ucd/name/src/name.rs
@@ -12,7 +12,7 @@ use core::fmt;
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub struct Name {
- pieces: &'static [&'static str],
+ pieces: &'static [&'static &'static str],
}
#[cfg_attr(feature = "clippy", allow(len_without_is_empty))]
@@ -47,5 +47,5 @@ impl fmt::Display for Name {
mod data {
use unic_char_property::tables::CharDataTable;
include!("../tables/name_values.rsd");
- pub const NAMES: CharDataTable<&[&str]> = include!("../tables/name_map.rsv");
+ pub static NAMES: CharDataTable<&[&&str]> = include!("../tables/name_map.rsv");
}
diff --git a/unic/ucd/name/tables/name_map.rsv b/unic/ucd/name/tables/name_map.rsv
index c002b09..fb42443 100644
--- a/unic/ucd/name/tables/name_map.rsv
+++ b/unic/ucd/name/tables/name_map.rsv
@@ -1,31527 +1,31527 @@
-// omitted (generated)
+// omitted (generated)
diff --git a/unic/ucd/name/tables/name_values.rsd b/unic/ucd/name/tables/name_values.rsd
index 454944e..264530d 100644
--- a/unic/ucd/name/tables/name_values.rsd
+++ b/unic/ucd/name/tables/name_values.rsd
@@ -1,13767 +1,13767 @@
-// omitted (generated)
+// omitted (generated) |
See rust-lang/rust#48009 for the upstream issue report. Turns out this is only on nightly (I thought my default at the time was stable but it was nightly). |
Some people at the miri thread has suggested to use an binary file for storing the items, then loading it with Maybe try using some serde-based format (which doesn't need a separate schema file) or Cap'n Proto (which is mmap-friendly) to store the data? |
I decided to work on a PR using Cap'n Proto. Stay tuned. |
Giving up for now due to capnproto/capnproto-rust#71 and extensive |
....I am so confused. The compile time unregressed on the latest nightly |
Uh oh!
There was an error while loading. Please reload this page.
It's definitely degraded from when it was first merged. I'm trying to make a self-contained case to submit to the rust-lang repository as an issue in compile times.
cargo +nightly rustc --package=unic-ucd-name -- -Z time-passes
Output
I think we may have stumbled across a quadratic time cost in the string interner, and my playing around with ways of formulating it back in #103/#125 stumbled across a case that at the time didn't do so bad for some reason.
(1.25 Nightly)
The text was updated successfully, but these errors were encountered: