I bet @gparker must've tried something along those lines in the past...
-
-
Two problems: One, many call sites really want a two-entry cache (mutable and non-mutable class, for example). Two, it costs too much dirty memory to do this everywhere so you need some way to choose at compile time where to apply it.
2 replies 0 retweets 3 likes -
Yeah, you can chain them to make polymorphic ICs (all JS engines do this). Can you use PGO to determine which call sites are hot?
1 reply 0 retweets 1 like -
It’s hard to believe that devirtualization is never worth it. objc_msgSend is pretty much always a BTB miss and that’s gotta hurt…
2 replies 0 retweets 1 like -
That’s not really true on newer architectures. Branch prediction with history in practice predicts msgSend fairly well
2 replies 0 retweets 2 likes -
Well enough that tricks that increase local code size or memory usage aren’t worth the systemwide costs, at least
1 reply 0 retweets 0 likes -
That would imply that JS inline caches aren't worth it. I'm skeptical, given that it's completely impossible to write a competitive JS engine without them.
3 replies 0 retweets 1 like -
I mean, it seems obvious that you will sometimes benefit from ICs, so the question is only what threshold you want to kick in the optimization at (via PGO), not whether you should do it at all.
1 reply 0 retweets 0 likes -
Profitable PGO thresholds are one problem. Another problem is that PGO and the associated performance measurement and feedback apparatus is not yet solved, as far as I know.
1 reply 0 retweets 0 likes -
Culturally I think ObjC programmers also tend to hand-optimize the hot parts of their code, either by not using messages at all or manually caching IMPs
2 replies 0 retweets 6 likes
Yeah, I was thinking this too. JS has more extreme demands on performance because devirtualization is necessary to call most anything. In Obj-C (and Swift), direct calls are more idiomatic for perf-critical code.
-
-
I still think PGO would result in wins, but I can understand it being lower priority than in JS.
1 reply 0 retweets 0 likes -
Like
@gparker said, the main issue with PGO is the workflow problem of collecting and maintaining good profile info, which AFAIK still hasn’t really been solved well.1 reply 0 retweets 1 like - 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.