8 ms·
Tracing JITs and Modern CPUs: Part 2
- LForLambda 11y agoIs it a thing to blog with github issues now?
- Everlag 11y agoIn theory blogging on github issues could actually be quite convenient. - Great(==standardized) markdown support. - Easy image support. - Uptime is someone else's problem. - Sending someone your blog also directly links them to your ~entire public codebase. - Builtin sane commenting system. - Can keep code beside the blog. Its aggravating to find a living blog that links to a dead code host. - Free with zero setup cost for everything above. - Not having to deal with ruby dependencies for jekyll... Edit: You know, I think I'm going to host my blog in this manner. When writing the above list I realized I'm sick of having to handle each of those.
- fche 11y ago(Seems like an "embarrassingly serial" problem -- a smarter lua could turn it into a single "set c = 1e9" instruction.)
- vidarh 11y agoIt could, but then we're getting into hairy language definition issues: Does Lua specify at what point updates need to hit memory? And this example is perfect example of why a language ought to be explicit about such guarantees - in this case such a change would have observable effects. Changing observable effects in optimizations is dangerous territory even when it's well defined.
- Dylan16807 11y agoWhat's memory? Lua's much more high level than that, and it makes no promises about timing at all.
- josefx 11y agoThat has nothing to do with high level, C++ for example also had no built-in guarantees for a long time. Making no promises about timing simply means that threading is either a non concept in the language (see C++ before 11) or the language declares everything to do with threading unspecified or undefined.
- Dylan16807 11y agoC++ has volatile.
- vidarh 11y agoThat's all nice when you don't need to know the effects of your code. It breaks apart the moment you want to interface with a system (like Snabbswitch) that uses memory as an IO mechanism, at which point if you can't depend on language guarantees, you need to depend on implementation guarantees - the same point stands.
- Dylan16807 11y agoThere's not really any downside to wrapping that interface in function calls, and then you don't have to worry about optimization.
- kendalharland 11y agoForgive my ignorance, but when writing a sufficiently large program, why would looking into the generated assembly be of use to a programmer? Wouldn't this turn into an arbitrarily large amount of instructions to sift through just to measure performance?
- tekacs 11y agoYou find the 'hottest' code (usually a loop, the code executed most) and examine very carefully the generated assembly for that and how it can be made more CPU/JIT/VM-friendly. This is an optimisation you perform when a small amount of code is consuming the overwhelming majority of your software's execution time (code very commonly has this property, until it is profiled and optimised). In addition, this case is for a high speed networking library, where every CPU cycle counts.