|
A couple of years ago I started making a compiler for a toy language. I ended up getting busy, so it got pushed onto the back-back-back burner. Usually that's where my projects go to die, but I really liked some of my ideas and wanted something to come of it. This weekend I finally found the time and the inspiration. I opened up the code and... hey, it's pretty good! It's well-commented and well-designed. All of my missing AST visitors are generating errors so I know exactly where I left off. I'll have no problem jumping back in and getting to work. Unfortunately, I lost the documentation for the language.
|
# ¿ Feb 6, 2010 06:05 |
|
|
# ¿ Mar 29, 2024 00:20 |
|
Scaevolus posted:This is a horror. Yes. De Morgan's laws.
|
# ¿ Dec 1, 2010 23:31 |
|
Scaevolus posted:No, the problem is about cache aliasing. Well, the first problem is conflict misses in the cache. The graphs they created show capacity misses, which is an unrelated problem. The real horror is microbenchmarking without taking at least one computer architecture course. quote:Every low-level performance related question on StackOverflow should be required to provide MFLOPS information for the whole range of cache relevant data sizes!
|
# ¿ Dec 20, 2011 01:21 |
|
Zombywuf posted:To be fair the compiler designer is supposed to have done that for you. "Any sufficiently smart compiler..." is the start of a lot of questionable ideas, not the least of which is Itanium. A lot of really simple-sounding optimizations turn out to be very difficult or impossible.
|
# ¿ Dec 20, 2011 03:35 |
|
yaoi prophet posted:What exactly happened with Itanium? Some day, when the space aliens come and give us their hypothetical future space alien compiler technology, we will all be running Itanium processors.
|
# ¿ Dec 20, 2011 04:33 |
|
Zombywuf posted:It's not a particularly complex bit of code, and it seems like nearly every single CPU tech enhancement of the last 20 years has been about making this kind of code faster. The horror is that all the enhancements have made it nearly impossible to optimise for. This specific loop splitting example is not a trivial optimization. For example, synonymous virtual addresses could introduce a true (RAW) dependency between loop iterations, and it is either impractical or impossible to detect this situation. This is obviously a rare counter-example, but it can happen, and as a language implementer you now have a choice to make about how you will allow the user to express this possibility. For these sorts of optimizations in general, at compile-time you know absolutely nothing about the memory hierarchy of the target machine. There are very many possible configurations and they all have distinct pathological cases which are potentially dependent on input. This means any optimization needs to be chosen at run-time, which effectively means you will need to emit a different branch for every known type of cache.
|
# ¿ Dec 20, 2011 21:14 |
|
Zombywuf posted:Soooo, what you're saying is that optimising for modern hardware is the real horror? No, the real horror is expecting the compiler to solve a design problem. If you are interested in high performance there are many safe assumptions you can make at the design level: spatial and temporal locality, and sequential access with a short stride, are all good decisions regardless of the specific processor you are using. You can't say nearly as much at the level of bit fiddling. (Edit: try the loop example from the Stack Overflow post using a single array with the values from A, B, C and D interleaved. The compiler and CPU cannot help you when you choose a stupid data structure like four arbitrary arrays.) Modern hardware might be difficult to understand, but it really is a lot faster. Keep in mind that the pathological cases are simply the same as not having a cache at all. Null Pointer fucked around with this message at 22:33 on Dec 20, 2011 |
# ¿ Dec 20, 2011 22:30 |
|
feedmegin posted:Not really. In theory the idea was that the Itanium chips could be very simple (and thus very highly clocked) This is the point of explicit instruction scheduling instead of using hardware, yes.
|
# ¿ Dec 23, 2011 00:30 |
|
pigdog posted:His game is a very good example though of a quality product. Code quality isn't in fact about how good the code looks, how reliable it is or whether it runs as fast as it could -- it's about whether people would want to use it. In this case, whether they'd want to play the game. Even it (in comparison) runs like rear end and is written badly, the game has still sold millions of copies and is by any means an unabashed success. This is a software engineering horror. 'Fitness for purpose' is not the same thing as quality. Consider PSN, before last April. Millions of people wanted to use it. Sure, Sony was transmitting and storing unencrypted credit card numbers, but nobody cared - information security just wasn't important to their customers. Hell, even after the breach, most people blamed the "hackers" for everything. By your definition, PSN was a very good example of a quality product. Do you think Visa and Mastercard agree with you? Picking on an indie game is low-hanging fruit, but Mojang's success and proven ability to deliver does not change the fact that Minecraft has serious defects.
|
# ¿ Apr 9, 2012 01:23 |
|
how!! posted:The fact that my theoretical refactor broke it and resulted in a fine is actually a good thing. At least now we can re-implement the Kwijybo Act of 1873 code, and this time we can do it so that its comprehensible and documented. The fine we had to pay is the price it costs to improve the business.
|
# ¿ Jan 17, 2013 02:09 |
|
|
# ¿ Mar 29, 2024 00:20 |
|
GrumpyDoctor posted:how!!, do you have a blog? If not, you should start one. I'd love to read it. Subject: Not updating for a while I broke the Kwijybo Act of 1873 code during a rewrite, and as it turns out that the Kwijybo Act of 1873 is an important part of Kwijybian environmental conservation law. Long story short, I'm now being prosecuted under the Lacey Act and I will probably go to prison. - how!! Current mood: apprehensive Current music: ~ One Winged Angel ~ Nobuo Uematsu
|
# ¿ Jan 17, 2013 03:35 |