Skip to content

Commit

Permalink
Improving icu_harfbuzz compiled data (#4574)
Browse files Browse the repository at this point in the history
The current HB compiled data code is not ideal, because it uses
`static_to_owned`, which might be blocking optimisations. This also let
me realise that some compiled constructors that could be `const` aren't.
  • Loading branch information
robertbastian authored Feb 27, 2024
1 parent d00c0d4 commit f411b72
Show file tree
Hide file tree
Showing 5 changed files with 517 additions and 281 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- `FormattedDateTime` and `FormattedZonedDateTime` now implement `Clone` and `Copy` (https://github.com/unicode-org/icu4x/pull/4476)
- `icu_properties`
- Add `Aran` script code (https://github.com/unicode-org/icu4x/pull/4426)
- Mark `BidiClassAdapter::new` as const (https://github.com/unicode-org/icu4x/pull/4584)
- Mark additional constructors as `const` (https://github.com/unicode-org/icu4x/pull/4584, https://github.com/unicode-org/icu4x/pull/4574)
- Implement Joining_Type property (https://github.com/unicode-org/icu4x/pull/4599)
- `icu_segmenter`
- Fix Unicode 15.0 line breaking (https://github.com/unicode-org/icu4x/pull/4389)
Expand Down
2 changes: 1 addition & 1 deletion components/normalizer/src/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl CanonicalComposition {
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "compiled_data")]
pub fn new() -> Self {
pub const fn new() -> Self {
Self {
canonical_compositions: DataPayload::from_static_ref(
crate::provider::Baked::SINGLETON_NORMALIZER_COMP_V1,
Expand Down
6 changes: 3 additions & 3 deletions components/properties/src/props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ macro_rules! impl_value_getter {
impl $ty {
$(#[$attr_n2e])*
#[cfg(feature = "compiled_data")]
$vis_n2e fn $cname_n2e() -> PropertyValueNameToEnumMapperBorrowed<'static, $ty> {
$vis_n2e const fn $cname_n2e() -> PropertyValueNameToEnumMapperBorrowed<'static, $ty> {
PropertyValueNameToEnumMapperBorrowed {
map: crate::provider::Baked::$singleton_n2e,
markers: PhantomData,
Expand All @@ -604,7 +604,7 @@ macro_rules! impl_value_getter {
$(
$(#[$attr_e2sn])*
#[cfg(feature = "compiled_data")]
$vis_e2sn fn $cname_e2sn() -> $mapper_e2snb<'static, $ty> {
$vis_e2sn const fn $cname_e2sn() -> $mapper_e2snb<'static, $ty> {
$mapper_e2snb {
map: crate::provider::Baked::$singleton_e2sn,
markers: PhantomData,
Expand All @@ -622,7 +622,7 @@ macro_rules! impl_value_getter {

$(#[$attr_e2ln])*
#[cfg(feature = "compiled_data")]
$vis_e2ln fn $cname_e2ln() -> $mapper_e2lnb<'static, $ty> {
$vis_e2ln const fn $cname_e2ln() -> $mapper_e2lnb<'static, $ty> {
$mapper_e2lnb {
map: crate::provider::Baked::$singleton_e2ln,
markers: PhantomData,
Expand Down
2 changes: 1 addition & 1 deletion experimental/harfbuzz/README.md

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

Loading

0 comments on commit f411b72

Please sign in to comment.