Production profiles show that generateProximityURIs is roughly 3.8% of
buildPreamble. Of this, the majority (3% of buildPreamble) is parsing
and reserializing URIs.
We can do this with ugly string manipulation instead.
|  Differential  D135226  
[clangd] Optimize Dex::generateProximityURIs(). Authored by sammccall on Oct 4 2022, 4:38 PM. 
Details 
 Production profiles show that generateProximityURIs is roughly 3.8% of We can do this with ugly string manipulation instead. 
Diff Detail 
 Event Timeline
 Comment Actions pointers -> StringRef 
 | ||||||||||||||
Is there a reason why you're doing this with manual manipulation of C-strings instead of StringRefs? I suspect passing StringRef here was not the problem, turning it into an std::string, from another std::string inside ParsedURI was.
Something like:
S = S.drop_while([](char c) { return c == ':'; });
S.consume_front(":");
if (S.consume_front("//")) {
S = S.drop_while([](char c) { return c == '/'; }); S.consume_front("/");}
return S;
would be a bit more readable and less likely to have an off-by-one somewhere, imho.