Re: [dev-servo] string-cache (string interning) is now generic

2016-11-03 Thread Boris Zbarsky
On 11/3/16 4:30 PM, Simon Sapin wrote: Servo defines: type AttrValue = std::string::String; type Identifier = servo_atoms::Atom; type ClassName = servo_atoms::Atom; type LocalName = html5ever_atoms::LocalName; type NamespacePrefix = html5ever_atoms::Prefix; Ah, perfect. Th

Re: [dev-servo] string-cache (string interning) is now generic

2016-11-03 Thread Bobby Holley
On Thu, Nov 3, 2016 at 1:30 PM, Simon Sapin wrote: > On 03/11/16 21:02, Boris Zbarsky wrote: > >> On 11/3/16 3:17 PM, Simon Sapin wrote: >> >>> An important aspect is that atoms with different static sets are >>> different Rust types. >>> >> >> Just to check that I understand correctly... >> >> A

Re: [dev-servo] string-cache (string interning) is now generic

2016-11-03 Thread Simon Sapin
On 03/11/16 21:02, Boris Zbarsky wrote: On 11/3/16 3:17 PM, Simon Sapin wrote: An important aspect is that atoms with different static sets are different Rust types. Just to check that I understand correctly... Are element names atoms? Which static set do they come from? Presumably the html5

Re: [dev-servo] string-cache (string interning) is now generic

2016-11-03 Thread Boris Zbarsky
On 11/3/16 3:17 PM, Simon Sapin wrote: An important aspect is that atoms with different static sets are different Rust types. Just to check that I understand correctly... Are element names atoms? Which static set do they come from? Presumably the html5ever one? When parsing CSS selectors,

Re: [dev-servo] string-cache (string interning) is now generic

2016-11-03 Thread Bobby Holley
This is awesome, and fixes a long-running pain point. Thanks Simon! On Thu, Nov 3, 2016 at 12:17 PM, Simon Sapin wrote: > # How it worked until recently > > Servo uses a crate called string-cache for string interning. It defines an > `Atom` type that represents a string (it dereferences to `&str

[dev-servo] string-cache (string interning) is now generic

2016-11-03 Thread Simon Sapin
# How it worked until recently Servo uses a crate called string-cache for string interning. It defines an `Atom` type that represents a string (it dereferences to `&str`), but it take 8 bytes of stack space (whereas `String` take three times that on 64-bit systems) and is fast to compare for e