Skip to content

how do I decrease the binary size of this crate? #963

Answered by BurntSushi
BurntSushi asked this question in Q&A
Discussion options

You must be logged in to vote

Currently, there are generally three contributors to the large binary size and compile times for this crate:

  1. Unicode data tables.
  2. Performance optimizations.
  3. A fair amount of practically indivisible code that's designed to handle lots of use cases. (Most of what's in regex-syntax, except for the Unicode tables.)

For (1) and (2), there are a number of crate features that can be toggled: https://docs.rs/regex/latest/regex/#crate-features

Specifically, try regex = { version = "1.7", default-features = false, features = ["std"] }.

For (3), there is some discussion about adding an entirely new regex-lite crate in #961 that focuses more heavily on reducing binary size and compilation time.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant