Skip to content
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

DurationFormatter: Remove allocations #5383

Merged
merged 30 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
089de2f
add separate hms, hm and ms padding structs
kartva Jul 21, 2024
c26347d
numeric formatting functions
kartva Jul 23, 2024
b66b7d9
add fractional truncation to format numeric second
kartva Jul 28, 2024
9dc37bb
add divergence note for twoDigitHours
kartva Jul 29, 2024
c959236
DurationFormatter constructor and digital test
kartva Jul 29, 2024
6cb98f9
fix fractionaldigit truncation
kartva Jul 29, 2024
447ceec
fmt
kartva Jul 29, 2024
810a2a5
add listformat
kartva Jul 31, 2024
cb5ab0c
Merge branch 'main' into duration-formatter-impl
kartva Jul 31, 2024
74e038a
DurationSign->fixedDecimal::Sign map Positive to None sign
kartva Jul 31, 2024
edce2ae
fix: incorrect hour digital default
kartva Aug 1, 2024
5b4e69f
add durationformatter tests
kartva Aug 1, 2024
ba27195
add compiled_data annotation to DurationUnitFormatter::try_new
kartva Aug 1, 2024
08483b9
change literal category
kartva Aug 1, 2024
6925942
remove references to partsink
kartva Aug 12, 2024
486ba11
Merge branch 'main' into duration-formatter-impl
kartva Aug 12, 2024
39cf59f
remove allocations from DurationFormatter
kartva Aug 16, 2024
c7b748c
tidy: grammar
kartva Aug 16, 2024
72bf6e5
Merge branch 'main' into duration-formatter-remove-allocation
kartva Aug 17, 2024
9ebe737
fix line duplication from merge
kartva Aug 17, 2024
6fdd0e5
fmt: format.rs: fix license header
kartva Aug 17, 2024
2311797
deps: add arrayvec to allowlist
kartva Aug 17, 2024
bf49a67
deps: remove arrayvec implicit std feature
kartva Aug 17, 2024
b0a7501
deps: move arrayvec to external dep group 1
kartva Aug 17, 2024
a16a7d0
deps: resolve icu_list/serde duplication
kartva Aug 19, 2024
d1eab88
deps: switch from arrayvec to smallvec
kartva Aug 19, 2024
42f2aa1
deps: enable const-generics feature for smallvec
kartva Aug 19, 2024
c351054
Merge branch 'main' into duration-formatter-remove-allocation
younies Aug 20, 2024
01a3642
tidy: rename DigitalDurationFormat -> DigitalDuration
kartva Aug 20, 2024
b18df4a
doc: add comment to test_duration_formatter
kartva Aug 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ diplomat-tool = { git = "https://github.com/rust-diplomat/diplomat", rev = "8744
# EXTRA_CAPI_DEPS
# EXTRA_BLOB_DEPS
# EXTRA_FS_DEPS
arrayvec = { version = "0.7.2", default-features = false }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: we already have smallvec in this list, can you use that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think arrayvec is slightly better than smallvec in this instance because there is a known, small upper limit to the length of the vector. smallvec has code and branching to overflow to the heap, which we don't need here.

arrayvec is in Cargo.lock so it's not a new dependency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. Flagging @Manishearth for the new runtime dependency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're adding another crate on top of smallvec, I think it should be heapless, which has more features than arrayvec. I'm not convinced this is worth adding another crate though.

core_maths = { version = "0.1.0", default-features = false }
displaydoc = { version = "0.2.3", default-features = false }
either = { version = "1.9.0", default-features = false }
Expand Down Expand Up @@ -263,7 +264,6 @@ serde-aux = { version = "4.0.0", default-features = false }

## External Deps Group 3: Dev and Datagen deps. Include default features.
arraystring = "0.3.0"
arrayvec = "0.7.2"
atoi = "1.0.0"
bincode = "1.3.1"
clap = "4.2.0"
Expand Down
4 changes: 3 additions & 1 deletion components/experimental/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ icu_normalizer = { workspace = true }
icu_plurals = { workspace = true }
icu_properties = { workspace = true }

arrayvec = { workspace = true, default-features = false }
databake = { workspace = true, optional = true, features = ["derive"] }
either = { workspace = true }
fixed_decimal = { workspace = true }
icu_pattern = { workspace = true , features = ["alloc", "yoke", "zerofrom"]}
litemap = { workspace = true }
Expand Down Expand Up @@ -71,7 +73,7 @@ default = ["compiled_data"]
compiled_data = ["dep:icu_experimental_data", "icu_decimal/compiled_data", "icu_list/compiled_data", "icu_plurals/compiled_data", "icu_properties/compiled_data", "icu_normalizer/compiled_data"]
datagen = ["serde", "std", "dep:databake", "zerovec/databake", "zerotrie/databake", "tinystr/databake", "icu_collections/databake", "std", "log", "icu_pattern/databake"]
ryu = ["fixed_decimal/ryu"]
serde = ["dep:serde", "zerovec/serde", "potential_utf/serde", "tinystr/serde", "icu_collections/serde", "icu_decimal/serde", "icu_list/serde", "icu_pattern/serde", "icu_plurals/serde", "icu_provider/serde", "zerotrie/serde"]
serde = ["dep:serde", "zerovec/serde", "potential_utf/serde", "tinystr/serde", "icu_collections/serde", "icu_decimal/serde", "icu_list/serde", "icu_list/serde", "icu_pattern/serde", "icu_plurals/serde", "icu_provider/serde", "zerotrie/serde"]
kartva marked this conversation as resolved.
Show resolved Hide resolved
std = ["fixed_decimal/std", "icu_decimal/std", "icu_pattern/std", "icu_plurals/std", "icu_provider/std", "icu_locale_core/std"]

bench = []
Expand Down
Loading