Live data from Hacker News

Clang Format Tanks Performance

travisdowns.github.io

1–10 of 156 posts

Re: Clang Format Tanks Performance

#3

Author here, happy for any feedback. I'll own up to misleading-and-possibly-clickbait title, I just gave up trying to think of anything better without revealing the conclusion.

Clickbait, but _good_ clickbait :) I do so love good deep technical blog posts that dig into why something works a certain way, and the title is a legit statement based on the initial cause. Thanks for writing this!

Re: Clang Format Tanks Performance

#5

Author here, happy for any feedback. I'll own up to misleading-and-possibly-clickbait title, I just gave up trying to think of anything better without revealing the conclusion.

clang format can tank performance” would, IMO, not decrease the number of people who click the link, yet remove the clickbait.

Re: Clang Format Tanks Performance

#7

Author here, happy for any feedback. I'll own up to misleading-and-possibly-clickbait title, I just gave up trying to think of anything better without revealing the conclusion.

Why does every title have to be a mystery? Why not tell people what it contains?

Re: Clang Format Tanks Performance

#10
post #9

A fascinating read. Is there a sane way to fix this in a future version of glibc?

I mean if you wanted the inline body to be visible to C++ you just have to slightly reorganize the ctype.h header so those definitions are available to C++ code (i.e., visible when __cplusplus is defined), because right now the bodies are getting caught the same #ifdef net that macro definitions are (but the body is not a macro).

That said, any exposure of implementation details, including inline bodies like this, is risky and constraining for future changes, since you bake in part of the implementation and also commit to supporting that implementation as far as you backwards compatibility strategy requires.

So it is entirely possible that the non-inlining is intentional, but then the part about include ordering mattering doesn't make sense, and if you are willing to commit for C programs, you are probably willing to commit in C++ too. You'd have to really spelunk the history of this files or ask the people responsible to be sure.

It seems more likely that that conditional compilation block is intended to avoid implementing standard library functions as macros, which is probably barred by the C++ standard (e.g., so you can use the name `std::tolower`) - and the inline bodies just got caught in the crossfire.

Post reply on HN