fitzgen / inlinable_string

An owned, grow-able UTF-8 string that stores small strings inline and avoids heap-allocation.
http://fitzgen.github.io/inlinable_string/inlinable_string/index.html
Other
69 stars 11 forks source link

Decrease size of structure InlinableString #1

Closed defuz closed 8 years ago

defuz commented 8 years ago

This PR decrease size of InlinableString structure:

There are two optimization:

  1. Using u8 instead of usize for storing inline length
  2. Change inline capacity from 32 bytes to 30 bytes for 64 arch and to 14 bytes for 32 arch to fit exactly into String size + 1 byte (discriminant) + alignment.

See detailed explanation into my Reddit comment.

fitzgen commented 8 years ago

Awesome, thanks! I was meaning to look into this in the future, thanks for the help :)

defuz commented 8 years ago

You're welcome! I am writing text editor on Rust and I think that your library will be very helpful. :)

fitzgen commented 8 years ago

Awesome! Emacs-like? Have you seen https://www.finseth.com/craft/ ? Might be a good read even if you're not righting an emacs-like editor :)