Live data from Hacker News

Random Acts of Optimization

engineering.riotgames.com

31–40 of 128 posts

Re: Random Acts of Optimization

#31
post #24

Earlier quoted context omitted.

I've gotten pretty good results from PGO as well as JIT optimizations (which isn't conceptually much different), but even if I hadn't, your comment is still a fallacy on two accounts: 1) JITs were slow until they weren't. Poor results from existing experimental PGO compilers do not prove that the concept is flawed. 2) Profiling is a heuristic substitute for a real cost model. The most advanced optimizing compilers fo…

And in theory, dependent types are the awesomest thing ever. But they're not ready yet, and there's no guarantee they ever will be. There's a gulf between even having a few focused, carefully-chosen proofs of concept and a practically-useful technology. (For that matter, I just grabbed that example off the top of my head as the thing I knew that most resembled the various fancy optimizers I've seen over the years, bu…

I think dependent types are amazing, but even the tiny subset of dependent types known as refinement types opens up huge avenues for optimization. Some optimizations (loop nest optimizations for a simple example) might only be feasible with static range definitions or with profile guided optimization...but if you throw in refinement types, you now have static guarantees as to the cardinality or range of a variable, and loop nest optimizations can be statically determined. I think full dependent typing could be great, but compilers can still be improved with small language improvements.

Re: Random Acts of Optimization

#32
post #26
post #16

Earlier quoted context omitted.

A rewrite would murder them. I'm not going to link that article everyone links about "never rewriting your code", because I don't think it's got the argument right, but I strongly feel that if they tried to rewrite a system as complex as theirs, they would either a) never finish or b) stop developing the game and, by the time they finished their rewrite, have no customers left. Anyway, it would end up being called a…

Not having a well-written client is murdering them. Sometimes the hard way is the best way.

> Not having a well-written client is murdering them.

"Murdering them" how?

Re: Random Acts of Optimization

#33

This brings up a thought that I've had for a very long time. Almost every type of optimization that a programmer could employ is repeatable. It involves matching patterns ("Identification" in the context of this article), analysis ("Comprehension"), and rewriting ("Iteration"). All of these steps can be efficiently automated. And it turns out that compiler writers collectively know about the vast majority of these te…

I love that v8 (nodejs /chromium, JavaScript) does JIT compiler optimizations. It means I can build for maintainability and still get the same performance as if I had built for speed. Ex: array vs object literal, or array vs object properties.

I still do higher level optimizations though, like caching and tweaking formulas (less computations), when needed.

Re: Random Acts of Optimization

#34
post #26
post #16

Earlier quoted context omitted.

A rewrite would murder them. I'm not going to link that article everyone links about "never rewriting your code", because I don't think it's got the argument right, but I strongly feel that if they tried to rewrite a system as complex as theirs, they would either a) never finish or b) stop developing the game and, by the time they finished their rewrite, have no customers left. Anyway, it would end up being called a…

Not having a well-written client is murdering them. Sometimes the hard way is the best way.

No, it isn't.

They have the most popular video game of all time and you think that a poorly written client is killing them? It has had some problems over the years that are annoying to users (and frankly embarrassing when compared to DOTA 2), but at the end of the day the quality of the client is insignificant to most players compared to the fun-factor of the game itself, as proven by their unprecedented success.

Re: Random Acts of Optimization

#36
post #26
post #16

Earlier quoted context omitted.

A rewrite would murder them. I'm not going to link that article everyone links about "never rewriting your code", because I don't think it's got the argument right, but I strongly feel that if they tried to rewrite a system as complex as theirs, they would either a) never finish or b) stop developing the game and, by the time they finished their rewrite, have no customers left. Anyway, it would end up being called a…

Not having a well-written client is murdering them. Sometimes the hard way is the best way.

I disagree. They seem to be doing fine, and their client seems to work fine and not detract from the game at all.

I play League a lot. There are bugs, sure, but altogether the game feels very polished. Much more so than many other games I have played. [There were two high-impact bugs in the current tournament that go counter to this, but they've been addressed already.]

The 'hard way' you espouse is ludicrous and far from the best way. It's not even an option. (Of course this is just my hunch, but it's a well-founded one)

[The ways that league does not feel polished are not related to code quality. They're much more around the new user experience and the toolset available to hardcore players (replays, sandboxes, among others).]

Re: Random Acts of Optimization

#37

Earlier quoted context omitted.

I've gotten pretty good results from PGO as well as JIT optimizations (which isn't conceptually much different), but even if I hadn't, your comment is still a fallacy on two accounts: 1) JITs were slow until they weren't. Poor results from existing experimental PGO compilers do not prove that the concept is flawed. 2) Profiling is a heuristic substitute for a real cost model. The most advanced optimizing compilers fo…

> Profiling is a heuristic substitute for a real cost model. Even a perfect cost model can't tell you the difference between hot paths and cold paths. Profiling can.

Actually, they can, and quite well actually. The dotnet native compiler actually does quite a few analyses for "hotness", mostly centered around maintaining cache locality. However if there is a lot of entropy in the possible code paths, it might not be computationally feasible to analyze the hotness of all of the paths. In those cases, we accept heuristic substitutes, of which both JITs and PGO have shown good results.

Re: Random Acts of Optimization

#38

This brings up a thought that I've had for a very long time. Almost every type of optimization that a programmer could employ is repeatable. It involves matching patterns ("Identification" in the context of this article), analysis ("Comprehension"), and rewriting ("Iteration"). All of these steps can be efficiently automated. And it turns out that compiler writers collectively know about the vast majority of these te…

Maybe for some cases, but sometimes (IMO) a compiler is just not going to know. For example, if instead of hitting the network on initialization for some information we delay load that later (say, for example, the MOTD), a compiler is never going to know it could do that.

Re: Random Acts of Optimization

#40
Hey everyone, I'm the author of this article and I'm glad you've found it interesting. I'll be keeping an eye on this thread, so if you have any questions or comments I'll address them as soon as I can. I can already see some awesome questions here - looking forward to the discussion.
Post reply on HN