6 ms·
“this code very fast” pull request to remove whitespace from linux kernel
- linopolus 9y agoYou could always put it through a C formatter after..
- phinnaeus 9y agoLots of people getting whooshed in the comments there.
- pvtmert 9y agothis guy is hilarious, well i am in the same country where he is from. Turkey obviously.
- roywiggins 9y agoWhile you're at it, minify all the symbols. That will make it much faster.
- to3m 9y agoI do indent my code, but I very rarely insert syntactically irrelevant spaces. I don't mind if clang-format (etc.) puts them in for me, but I don't add them by pressing keys myself and I don't have a problem reading code that leaves them out (since that code looks just like the code I write myself before I run it through clang-format). This has long been my habit, since I started out on a computer with 32K RAM, where putting in extra spaces just meant you'd need to use shorter variable names to balance things out. (Here's a photo of some representative code I wrote for a reddit contest a couple of years ago: http://ffe3.com/pics/.beeb/IMG_1373.JPG http://ffe3.com/pics/.beeb/IMG_1373.JPG - not much different from what I wrote in the early 1990s as a teenager. But I did typically use longer variable names back then, because unlike this case I wasn't concerned about fitting the whole listing on one 40x25 screen...) Even today, doing this still means fewer L1 cache misses in the scanner.
- jmull 9y agoHa, that takes me back. I got started on Commodore BASIC on an 8K PET. Your program had to share memory with the source code, so you didn't waste bytes on spaces! (You also used single character variable names as much as possible and jammed as many statements on a line as possible since the overhead per line was a few bytes.) As a result I can still read very dense code, but I'm reformed and write code that uses white space to avoid an overly busy screen, suggest coupling in the underlying logic, aligns comments, etc.
- copx 9y agoYour code is still needlessly verbose. Have you ever seen how the ancient Romans wrote Latin? Not only no white space, no interpunctuation either, and everything in uppercase. E.g: http://ratcliffe-college.co.uk/wp-content/uploads/2015/09/Latin-IMG2.jpg http://ratcliffe-college.co.uk/wp-content/uploads/2015/09/La... So instead of.. FEO1:INX:LDAS:STX .. you should just write: FEO1INXLDASSTX Now that is concise code!
- Danihan 9y agoYet that language died, go figure..
- lomnakkus 9y agoIt has a sort of Fortran-esque feel. Almost like the classic "DOI=[etc]" parsing puzzler.
- DaiPlusPlus 9y agoYESITSVERYCONCISEHOWEVERIMNOTSUREABOUTHOWREADABLEITISWHENYOUHAVEAMBIGUOUSLYSPELLEDWORDSWHERELETTERSCOULDBELONGTOONEWORDORANOTHER.
- 0xBA5ED 9y agoSurprisingly, I didn't have a hard time reading that. Maybe because I had a good idea of what the context would be before hand... Hmmmm, interesting thought of the day.
- TazeTSchnitzel 9y agoWasn't there an embedded JS implementation where whitespace slowed down code execution?
- twiss 9y agoThere was also this: https://news.ycombinator.com/item?id=12119080 https://news.ycombinator.com/item?id=12119080 ("Tabs slower than spaces in Firefox")
- bmcooley 9y agoA few years ago I was playing around with arduino, and adding comments increased the executable file size.
- rjeli 9y agov8 used the string length of a function, including comments, to determine whether to inline. HotSpot used (uses?) bytecode length of a method, so adding useless lines would affect performance.
- TazeTSchnitzel 9y agoI'm aware of V8, but what I'm thinking of was something worse: JS for embedded devices that apparently interpreted the code on-device without even compiling to bytecode.
- chainsaw10 9y agoIt doesn't compile though -- I hope. I'm pretty sure C keywords require a space on either side...
- Jach 9y agoMissed opportunity to put in some zero-width unicode spaces just to add that extra bit of uncertainty for whether gcc would respect it...
- altotrees 9y agoSo many people taking it seriously. I have never attempted to commit anything to the kernel, but it seems like a tough crowd in some areas.
- roblabla 9y agoI'm fairly sure that there's almost no serious kernel developer answering here. Kernel contributions don't go through github PRs but through mailing lists. The "tough crowd" you see here are trolls - not the actual community, which is inclusive and quite nice to work with.
- altotrees 9y agoI was going to ask about that, if these were in any way core contributors. I figured most of those serious enough to make helpful commits wouldn't take the bait.
- grkvlt 9y ago> And actually most of the C and C++ bugs beside the bad logical implementation which would be a fault of a person who write the code is the problem with not dealocated memory or pointers that point to a wrong part of memory and make programs crashes. In other words buffer overflows and stack smashing which all lead to segfaulting or even worse if they are not properly handled by the operating system like in case of Micro$hit windblows. Yes, I would hope no kernel contributor ever refers to Micro$hit windblows, or has such atrocious grammar and communication skills. It seems like this guy is trying to explain the C memory model, but doing a terrible job. I would have guessed that most of the commenters are children in high school, but worryingly many seem to be full-grown adults. This excerpt (above) is from a comment made by a GitHub account that is six years old and who claims to be an 'Experienced Linux System Admin'...
- SwellJoe 9y agoThis is kinda awesome only because lots of people can't tell if it's a joke or not. I'm reasonably confident it is, but the fact that a lot of people can't tell makes it pretty funny. And, the account that posted it is seemingly new enough to programming to maybe have no idea that it's ridiculous. So, it may even be sincere, which is less funny, but still caused me to think about it for a minute. Also, I admire the handful of people who commented with a sincere explanation about why it's wrong. I don't have that much patience, but I'm happy that people who do exist.
- lomnakkus 9y agoIt's quite funny, but I think (hope) that it's a satirical poke at JS minification...? (... which, admittedly, would be quite strange now that I think about it. I didn't check, but I assume that there was no variable renaming in the "added line". Hmm... Regardless, I had a good laugh, so it's all good.)
- whipoodle 9y agoThe diff itself is pretty funny. But yeah I have no idea how serious this is meant to be.
- crispinb 9y agoI can't tell whether or not it's a joke. What I can clearly see is the whole reason I left working in tech: the field is stuffed full of deeply unpleasant and unkind people.
- SwellJoe 9y agoYeah, I try to look past it, but we really are a bitter and angry community on average; anyone different, anyone less skilled, anyone who can be "othered", is treated with disdain by a lot of our peers. It never stops being disappointing...though I also understand the feeling that leads to it. Some days I genuinely hate my projects users for being so utterly helpless and having bizarre mental models for how things work. As I've gotten older and, I think, kinder, I try to take a break when I feel like ranting or condescending at a person rather than helping. I don't always succeed, but I wish more people would try.
- msla 9y agoIt's almost certainly a joke, but defaulting to treating things you think are a bad idea as if they were jokes is fairly hostile behavior which makes it impossible for controversial issues to be discussed because someone will treat the side they don't support as being so obviously stupid it must be a joke, which can be dismissed without consideration.
- eigenbom 9y agoBest joke I've heard all day.
- Retr0spectrum 9y agoWhy don't we just compile the kernel to machine code, and distribute that instead? This would completely eliminate waiting for kernel compilation.
- kbr 9y agoMachine code varies depending on the platform, and Linux is meant to be distributed to a _ton_ of platforms.
- PrimHelios 9y agoThat's the joke. The kernel is already distributed as compiled machine code.
- kbr 9y agoWhoops haha didn't catch that :)
- function_seven 9y agoTrue, but we can just use the subset of machine code that works on all of them. Us web developers figured this out with JS, when IE supported different methods than WebKit and Mozilla. If we can do it, I’m sure you can assemble something that’s universal as well.
- DaiPlusPlus 9y ago> True, but we can just use the subset of machine code that works on all of them. All you need to be Turing-complete is `add`, `jne`, and that's pretty much it - and every mainstream instruction set today supports at least those 2 operations: https://en.wikipedia.org/wiki/One_instruction_set_computer https://en.wikipedia.org/wiki/One_instruction_set_computer Of course the computer would run terribly - so I hope you're joking there. A a web-dev analogy, it's like saying we should abandon CSS and use <table>-for-layout because you don't want Internet Explorer 4.0 users to be left out.
- AaronFriel 9y agoAh, someone must have mistaken this for the Gentoo repository. This sort of patch should be maintained by downstream distributions where concerns like speed are overriding concerns. Me, personally? I found that compiling was a lot faster if I ran "rm -rf ." first.
- Pxtl 9y agoSolving the tabs vs spaces debate and the cr/lf debate using the Gordian Knot approach.
- tolgahanuzun 9y agoI do not think he's joking. JS thinks in logic. :D
- fka 9y agoSeems like he made an irony. a.k.a. troll. Details (in Turkish): https://palmiyria.blogspot.com.tr/2017/05/test-yazisi.html?m=1 https://palmiyria.blogspot.com.tr/2017/05/test-yazisi.html?m...
- fka 9y agoHowever, the dates are strange. post about this troll: 24.05.2017 github pr: 17.07.2017 the SS on post: 25.07.2017