TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Hello. I'm a compiler

472 点作者 andremedeiros超过 12 年前

28 条评论

cobrausn超过 12 年前
This was linked in the comments (by the author):<p><a href="https://www.facebook.com/sedatk/posts/10151240841812644" rel="nofollow">https://www.facebook.com/sedatk/posts/10151240841812644</a><p><i>Sedat Kapanoglu · 2,372 followers<p>3 hours ago near Maslak, Istanbul<p>Today I was at the Istanbul courthouse third time this year. I attended a trial defending myself to a judge. Then I bore my testimony to a prosecutor about a different case. Both cases were about the free speech platform I own in Turkey. Meanwhile in the world, one of my older posts in Stackoverflow became Hackernews #1 &#38; reddit/programming #1. I wish it was Turkey which made me feel better about myself, not the rest of the world.</i>
Xcelerate超过 12 年前
The poor compilers do the best with what they have. And by "what they have", I mean the things they can't make assumptions about. Which turns out to be a crapload. Until that happens, very highly-tuned assembly will continue to outperform the best compilers.<p>Of course, a more typical scenario is hand-tuning a few loops where 99% of the clock cycles occur and letting the compiler take care of the rest.<p>(Also, I was attempting to send a Morse code message by flashing the vote counter between up and down, but I don't think anyone got it :( )
评论 #5243780 未加载
评论 #5244568 未加载
评论 #5243732 未加载
评论 #5243709 未加载
评论 #5243937 未加载
gilgoomesh超过 12 年前
Cute. Although I think my compiler has different things to say.<p>Hello, I'm a C compiler that still can't handle C99. I hope you're wearing waterproof clothing because I'm gonna throw up on you. Also, I've been drinking heavily so your C++ code is going to take a while to compile and when it's done, it's gonna smell funny.
评论 #5243785 未加载
qompiler超过 12 年前
Hello. I'm a programmer.<p>I noticed you couldn't optimize my code to use SIMD so I went ahead and used inline assembly. It will probably take another 30 years before you can actually think like a human and perform optimizations like this.
评论 #5243706 未加载
评论 #5243951 未加载
评论 #5243802 未加载
评论 #5243629 未加载
评论 #5243639 未加载
评论 #5243883 未加载
评论 #5243640 未加载
评论 #5243664 未加载
评论 #5244539 未加载
评论 #5243666 未加载
oliland超过 12 年前
This answer purports a myth that compilers are magical black boxes, the sum of millions of hours of intense academic research that "you will never understand".<p>Replace "compiler" with "computer". Doesn't that make you angry? Answers like these do nothing but prevent people from learning about them.<p>If you are interested in compilers, here's Edinburgh University's notes from the course "Compiling Techniques", probably a good place to start. Don't let internet tough-guys stop you from learning.<p><a href="http://www.inf.ed.ac.uk/teaching/courses/ct/" rel="nofollow">http://www.inf.ed.ac.uk/teaching/courses/ct/</a>
评论 #5244730 未加载
评论 #5244884 未加载
评论 #5244910 未加载
评论 #5244930 未加载
评论 #5244901 未加载
Breakthrough超过 12 年前
And on the Fourth Day, God proclaimed "Thou shalt have the ability to use inline assembly in thy C/C++ code for performance-critical tasks".<p>I can think of absolutely zero reason to write an entire program in x86 assembly, let alone any other kind of assembly (GCC spits out some pretty optimized code for my little Atmel MCU)... It's a lot nicer to write everything in a high-level, and then write any performance specifics in inline assembly.<p>The really cool thing to see is how other newer languages have adopted this scheme (e.g. PyASM for Python, or the ability to edit the instructions for interpreted languages that run in their own VM). And as always, great power comes with great responsibility ;)
评论 #5245007 未加载
评论 #5245162 未加载
ck2超过 12 年前
Are they pushing those realtime vote counts with websockets? Pretty slick. Beats polling by far.<p>Looks like IE is holding it back as usual:<p><a href="https://developer.mozilla.org/en-US/docs/WebSockets#Browser_compatibility" rel="nofollow">https://developer.mozilla.org/en-US/docs/WebSockets#Browser_...</a>
评论 #5243819 未加载
评论 #5244902 未加载
评论 #5243801 未加载
ck2超过 12 年前
Isn't Steve Gibson ( <a href="http://www.grc.com/stevegibson.htm" rel="nofollow">http://www.grc.com/stevegibson.htm</a> ) still coding large, complex programs in pure assembly?<p>His work on spinrite is legendary, for those born before IDE hard drives were invented.
评论 #5245096 未加载
Swizec超过 12 年前
Fascinating, while I was reading that, it got 5 upvotes! Mindblowing.<p>This is a really awesome description too. The only thing I know about compilers is that I implemented one for class (without fancy optimisations) and I am surprised any software works, ever. Compiler are just ... mindbogglingly complex things. Almost as much voodoo dark magic as engineering.
评论 #5243687 未加载
评论 #5243816 未加载
Arjuna超过 12 年前
Anytime I read about the topic of assembly language, I can't help but think of Michael Abrash. For example, check out Chapter 22 [1] from his <i>Graphics Programming Black Book</i> entitled <i>Zenning and the Flexible Mind</i> for a pleasant stroll down Optimization Lane.<p>You might also enjoy his book entitled <i>The Zen of Assembly Language</i> which features the Zen Timer (a timing tool for performance measuring).<p>[1] <a href="http://downloads.gamedev.net/pdf/gpbb/gpbb22.pdf" rel="nofollow">http://downloads.gamedev.net/pdf/gpbb/gpbb22.pdf</a>
davidroberts超过 12 年前
The best comment: "Thank you compiler, but perhaps if you weren't commenting on StackOverflow, you could get me a drink and play some nice music while you're working?"
friendly_chap超过 12 年前
You can see the upvote counter constantly being updated ATM :)
评论 #5243607 未加载
dragontamer超过 12 年前
Hey, my name is ICC, and I'm one of the most respected compilers in the industry. I also sabotage your code so that it works poorly on AMD CPUs, while making sure that Intel CPUs run my code at full speed. After all, Intel likes to establish market dominance.<p><a href="http://www.agner.org/optimize/blog/read.php?i=49#49" rel="nofollow">http://www.agner.org/optimize/blog/read.php?i=49#49</a><p>Blind trust in the compiler is bad people. Good luck discussing this issue without any Assembly Programers who can fully understand what is going on here.
mmphosis超过 12 年前
Hello, I am a programmer.<p>I have little idea what modern day compilers are doing, or what the CPU, or the operating system is doing for that matter. Often, way too often, compilers fail, hardware fails, operating systems fail, lots of things fail. I am not going to read the millions of lines of code written by other programmers (in f-ing emacs no less) in the any number of differing complex beasts, the compilers. It seems crazy-making to me, that other programmers would create compilers that would use millions of possibilities of optimizing a single line of mine using hundreds of different optimization techniques based on a vast amount of academic research that I won't be spending years getting at. I do feel embarrassed, yes very icky, that I have little to no idea what a three-line loop will be compiled as, but bloat would be my guess. There is risk in going to great lengths of optimization or doing the dirtiest tricks. And if I don't want the compiler to do this, I have no idea how to stop this behavior, nor do I want to invest in the specific knowledge of the nuances any particular compiler. The compiler does not allow me easy access because the compiler itself is an overly complex piece of software written by other programmers. I could care less about how a compiler would make my code would look in assembly, on different processor architectures and different operating systems and in different assembly conventions. Transformation comes with how we as programmers write code, not in compiler-fu.<p>P.S. Oh, and by the way if I really wasn't using half of the code I wrote, I would throw the source code away.
评论 #5244184 未加载
评论 #5244307 未加载
johncoltrane超过 12 年前
This is the first time I see the vote count grow by 10 in real time. Impressive stuff.
dragontamer超过 12 年前
Hello. I'm an assembly programmer. I used a compiler to generate the majority of code, and can hand-craft any assembly that comes out of it. I understand how compilers auto-generate SIMD instructions can be more easily compiler-generated if I make a "struct of arrays" instead of "an array of structs".<p>TLDR: Real performance programmers need to understand the assembly a compiler generates if they hope to tune the compiler to generate optimal assembly. Also, GCC -O3 is prone to removing too much code and reordering it, causing memory barrier issues and the like. All multi-threaded programmers need to understand how the compiler generates assembly (ie: by reordering your code), and how it can generate new bugs if you don't use the right compiler flags.
评论 #5244782 未加载
yen223超过 12 年前
It isn't closed or locked? Huh.
评论 #5243631 未加载
评论 #5243763 未加载
评论 #5243981 未加载
orangethirty超过 12 年前
As someone who is working on a project where the CTO demands more LOC, this makes me warm inside.
评论 #5243831 未加载
评论 #5243734 未加载
jordanwallwork超过 12 年前
Am I the only one just enjoying watching the upvotes rocketing up on SO?
评论 #5243901 未加载
评论 #5243757 未加载
评论 #5243849 未加载
kaffeinecoma超过 12 年前
I never noticed that the Stackoverflow js pulls updates for vote tallies in real-time. Browsing this answer while HN is sending lots of traffic there is almost like watching a car odometer.
_kst_超过 12 年前
<a href="http://imagemacros.files.wordpress.com/2009/07/hianteater.jpg" rel="nofollow">http://imagemacros.files.wordpress.com/2009/07/hianteater.jp...</a>
opminion超过 12 年前
Ah, the irony of Knuth being the proponent of Literate Programming, and at the same time the last man standing in general purpose assembly.
jawerty超过 12 年前
It's even better when you read what the question was.
Nikolas0超过 12 年前
Now I can't wait to get a message from the kernel :D
majmun超过 12 年前
Compiler got AI human language capabilities?
detay超过 12 年前
Yet another spark of genius from ssg.
评论 #5244428 未加载
mrleinad超过 12 年前
Really? HN is now including witty posts in Stackoverflow as news?
dschiptsov超过 12 年前
It is funny how people want to believe in tools. In fact, the optimizations compiler does are incomparable with those programmer could do by choosing an appropriate data-structure with corresponding algorithms and by being aware of strengths and weakness of a particular CPU architecture.<p>JVM, which is nothing but a stack-based byte-code interpreter is the most famous case.) People seems to believe it can do wonders, especially in memory management and data throughput.<p>It is so strange to see how people are trying to create a whole world inside a JVM. What it is called when people are building models of ships inside a bottle?)<p>btw, now, it seems, they are trying to build a whole world inside a V8 bottle.)
评论 #5243860 未加载