getsentry / rust-sourcemap

A library for rust that implements basic sourcemap handling
Other
224 stars 27 forks source link

feat: Replace `unicode-id` crate with `unicode-id-start` #78

Closed Boshen closed 8 months ago

Boshen commented 8 months ago

We've gone full circle :sweat_smile:

The unicode-id and unicode-id-start crates were cloned from unicode-xid and unicode-ident for usages in the oxc project.

Oxc will be using this crate for sourcemap support, and is currently using the better optimized unicode-id-start crate. I don't want to include two similar dependencies due to the rather large static storage size of these crates.

The unicode-id-start crate is also faster and uses slightly less static storage. See full details at https://github.com/oxc-project/unicode-id-start/tree/master?tab=readme-ov-file#comparison-of-performance


The version "1" is used instead of the latest version because the crate is stable, future versions will only include unicode version upgrades.


And thank you Sentry for the sponsorship due to the inclusion of unicode-id crate ❤️

Boshen commented 8 months ago

For detecting JavaScript identifiers, oxc has an optimized routine which this crate could use. I can add the code to unicode-id-start if we want more performance :-) https://github.com/oxc-project/oxc/blob/27052ebfed27d8aa97913d26f95d285d9cb58e51/crates/oxc_syntax/src/identifier.rs#L66-L137

Swatinem commented 8 months ago

lgtm

Though I believe this whole module, and sourceview which is the only other module that uses this might be headed out the door once we get around to #71

Boshen commented 8 months ago

Fixed the clippy warning, ready to merge, and possibly a release 😁