> Another idea I like is to introduce a separate immutable prepopulated (with > tag names, attribute values, CSS properties and keywords, known-to-be popular > values, etc) table that uses the same hash values as the mutable concurrent > table (so we don't have to compute the hash value twice)
That sounds good. Right now I'm putting together static interning in the HTML parser using rust-phf [1], but converging on the same hash as the dynamic table definitely makes sense. > and use tag bits to identify the table an intern value belongs to If an interned string is a pointer to a canonical copy of the string, then most operations won't care whether it's a pointer to static or dynamic memory. And if we do need to distinguish (for refcounting or something), we can look at the memory map. keegan [1] https://github.com/sfackler/rust-phf ----- Original Message ----- From: "Robert O'Callahan" <rob...@ocallahan.org> To: "Keegan McAllister" <kmcallis...@mozilla.com> Cc: dev-servo@lists.mozilla.org Sent: Wednesday, April 23, 2014 5:35:29 PM Subject: Re: [dev-servo] Table-less string interning It seems like it would be a good idea to instrument Gecko to gather a trace of intern operations from regular Web browsing that you can run against test programs. Making the interned atom for <= 8-char or 4-char ASCII strings be the string itself is a really interesting idea. Another idea I like is to introduce a separate immutable prepopulated (with tag names, attribute values, CSS properties and keywords, known-to-be popular values, etc) table that uses the same hash values as the mutable concurrent table (so we don't have to compute the hash value twice) and use tag bits to identify the table an intern value belongs to. Seems like combining those ideas might get good results without being complex. Rob -- Jtehsauts tshaei dS,o n" Wohfy Mdaon yhoaus eanuttehrotraiitny eovni le atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o Whhei csha iids teoa stiheer :p atroa lsyazye,d 'mYaonu,r "sGients uapr,e tfaokreg iyvoeunr, 'm aotr atnod sgaoy ,h o'mGee.t" uTph eann dt hwea lmka'n? gBoutt uIp waanndt wyeonut thoo mken.o w _______________________________________________ dev-servo mailing list dev-servo@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-servo