10 ms·
I do know how computers work, at the transistor level. But it boggles the mind to try to understand how a computer works from the transistor level to the point
by jimmyswimmy 6y ago
I do know how computers work, at the transistor level. But it boggles the mind to try to understand how a computer works from the transistor level to the point of where your mouse icon traverses across the screen. Trying to understand it at all levels will really give you a headache. Or at least, it does for me.
I tend to think that if more people understood how to program at this level, the weight of software and websites would be a lot less. I can't log in to my bank website without download 1 MB of crap. It's super easy to program using by importing * but if you can write in assembly you can really optimize. It's just not worth the effort these days. So the improvement of Moore's law (RIP) ends up going to programmers' salaries instead of to performance improvements. Kind of an interesting way to think about it.
- woo49 6y agoMy CS systems PhD advisor used to say, 'you waste the abundant resource' in systems design. Lots of CPU cycles available, lots of bandwidth available (except when not!) - so waste it and save programmer time. At least, in theory. It's not about knowing assembly or not. It's resources, time, cost, money, ROI.
- xmprt 6y agoEven after knowing assembly, there's probably significant optimizations that can be done if you design chips and ISAs that are specific to a certain problem. There's "waste" at every stage of abstraction.
- deathgrips 6y agoThat's not waste, that's a tradeoff.
- ClikeX 6y agoIt's a choice you need to make when developing. I had to build a one-time export yesterday. Am I gonna spend a lot of time optimizing the speed of it? Or am I going to make it work and get the export to the client faster? It would've wasted my time and the clients money if I optimized the queries. Sure, the export itself took longer. But overall, the task was done quicker. If the client wanted this export to run on their server frequently, I would've spend the time making sure the export itself runs faster.
- taneq 6y agoExactly. Yout goal isn’t to optimise the code, it’s to optimise the overall cost/benefit of whatever you’re doing.
- PeterisP 6y agoIt's especially relevant when thinking not at the level of computer systems but business systems - since for many tasks you anyway have a combined computer+people process that works for some goal, and there's a tradeoff between computers and people for choosing the level of automation you want. For exmaple, in your example of a one-time export it might also make sense to write code that does not meet all requirements and explicitly can not handle certain edge cases, if it's more effective to fix these cases manually than try to automate that.
- inglor_cz 6y agoIn my country, water consumption was not measured prior to 1989. Households just paid a lump sum and the price was kept on 1953 levels. Yes, once measurements were introduced after the Velvet Revolution, water consumption by households fell to half almost overnight.
- MaxBarraclough 6y agoReminds me of Jevons paradox: > when technological progress or government policy increases the efficiency with which a resource is used (reducing the amount necessary for any one use), but the rate of consumption of that resource rises due to increasing demand https://en.wikipedia.org/wiki/Jevons_paradox https://en.wikipedia.org/wiki/Jevons_paradox
- deleted 6y ago[deleted]
- AmericanChopper 6y ago> I tend to think that if more people understood how to program at this level, the weight of software and websites would be a lot less. I’ve done assembler work, I’m perfectly competent at it. I would never try to build a website in anything low level like that. It’s optimizing for completely the wrong set of problems. The world has lots of network bandwidth, cpu cycles and volatile memory. You won’t find many situations where having a better performing website is worth sacrificing the savings in human labor you get from high level abstractions.
- tcgv 6y agoI have a degree in electronic systems engineering. At college I learned about both digital and analog circuit design and fabrication. Had my fair share of FPGA and Assembly programming. Built some microcontrolled printed circuit boards. In summary, I believe I have a reasonable understanding of how computers work underneath, and I'm not interested in using anything other than a high level programming language for consumer application development as well ;)
- dboreham 6y agoAmusingly, in high school my physics teacher told the class a story about how things had become so complex that no single person could understand everything about the classroom computer. That was in 1978 and the computer was an Apple II.
- WalterBright 6y agoIt was entirely possible in those days to understand everything from transistors, to digital logic gates, to flip-flops, to clocks, to adders, to registers, to 8 bit computer chips, to assembler, to the primitive BASIC on an Apple II.
- jacobush 6y agoBut how transistors work is very sketchy to me
- WalterBright 6y agoYou really need a course in Quantum Mechanics to understand it. But a workable description is a couple pages in most electronic textbooks. MIT covers it in their first course in electronics on Youtube.
- agumonkey 6y agoQM would be ultimate foundational understanding. A transistor is a valve. Here, problem solved :D
- cinntaile 6y agoA generic course in QM won't really help you understand electronics any better. Perhaps if you have a background in electronics or if the course makes attempts to link QM with electronics but otherwise it's just relatively abstract physics.
- selecsosi 6y ago
- xmprt 6y agoI think the problem is actually the opposite. There aren't enough abstractions that help programmers write good code. So when a programmer has to do something complex, they end up doing the easy thing which is just importing every library they need. If instead, there was a way to say "only import this when I'm doing this action" and there's no way for the programmer to explicitly say what to import, then that problem almost disappears.
- eklavya 6y agoBut the compiler is going to shake the tree and not include anything not being used right?
- jamil7 6y agoI can’t tell if this is sarcastic or not. Tree shaking isn’t a silver bullet and really only works under specific circumstances. Better to not include the library to begin with.
- tylerhou 6y agoNot sure if this is sarcastic, but... 1) In dynamic languages, it's not possible to detect whether a function is used or not in the general case. For example, consider string accesses on objects. If the compiler is not sophisticated enough to resolve the set of possible strings at compile time (or such analysis would unacceptably increase compile times), then you can't shake out unused methods on that object. [1] 2) For languages like C and C++, the compiler cannot tree shake because it only knows about a single file at a time (translation unit, to be precise). You would have to rely on link-time optimizations to effectively tree shake, but LTO is not well-supported by all toolchains. Tree shaking also has a cost that I mentioned earlier -- it increases compile times. Both LTO and tree shaking in dynamic languages increase compile times superlinearly [citation needed] wrt. the size of your application. As other commenters have mentioned, it's better to avoid including unnecessary libraries in the first place. There are no cost free abstractions, and that applies to tree shaking as well. https://www.youtube.com/watch?v=rHIkrotSwcc https://www.youtube.com/watch?v=rHIkrotSwcc [1] For the pedants: yes, I know resolving the possible set of values (stricter than "all possible values for that type") for a variable is undecidable in the general case.
- im3w1l 6y agoThe big reason that everything is so slow is that we just can't standardize on things. For example assembler: There are many to choose from! So we solve this by building slow abstraction layers. But we can't standardize because technology is improving so quickly. Any standard would be quickly obsolete. If we ever standardize on one CPU, one screen size, one GPU, etc etc. Then we can make big gains by hyperfocusing on this.
- pathseeker 6y ago>So the improvement of Moore's law (RIP) ends up going to programmers' salaries instead of to performance improvements. This statement doesn't really make sense. If programmers spent the time to optimize everything instead of gluing a bunch of inefficient libraries together, software would cost even more than it does now. So that's even higher salaries because there is even more business competition for the same pool of available programmer hours in the workforce (and that doesn't even take into account the fact that you would wipe out 90% of the programming workforce if writing assembly is required). Moore's law means that you can afford inefficient code, so it's taking money from programmers and keeping it in the businesses that would have originally had to pay for a hand-tuned piece of code.
- konjin 6y agoMoore's law for performance has been dead for 15 years. No one's noticed though.
- dTal 6y agoThere is no "Moore's law for performance". Moore's law is a statement about the number of transistors on a chip, nothing more (Moore?). And sure enough, the Threadripper machine I built this year has about double the number of transistors as the Threadripper machine I built last year, which has about double the number of transistors to the one before that... (although this is partly a function of increasing budget; Moore's law specifies a two year doubling). But sure, if you want to talk performance - the fastest CPU this year, the Threadripper 3990X, is over 100x faster than the fastest CPU of 2005, the Athlon 64 FX-57. That's about 7-8 doublings, or pretty much spot on.
- mcguire 6y agoFaster how, exactly? The clock rate is ~4/3. It has 128 half-cores, but the benefits will depend on the workload. :-)
- konjin 6y agoFor a very long time between 1970 and 2005 doubling the transistors halved the time taken for any task. We're well past this point. If you don't think so try and calculate a_{i+1} = rand_int() a_i mod 232 on a machine from today and one from 2005. Then do the same with a machine from 2005 and 1990.
- MaximumYComb 6y agoI have known from the transistor level through to the mouse moving on the screen, just not all at once. If I put the effort in then I know I could have a solid grasp of all stages at once but it would be a waste. If you're programming in assembly then you're dealing with instruction sets. You don't need to know how transistors make up a NAND gate to program with instructions, or even how gates fit together to make higher order components. You just need to need you have a processor and memory.
- Joeri 6y agoTo write highest performance assembly code you need to understand more than the instruction set. You need to understand about cache hierarchy and how cache lines are filled, about microcode and how to fill the pipeline, including how to exploit hyperthreads, what the consequence of different workloads is on boost speeds, how the vectorized instructions map to hardware and when the trade-off is worth it, etc... Not to mention that you really also need to be a GPGPU expert so you can trade off work to the graphics hardware when necessary. One can write assembly while knowing only a fraction of that stuff, but the compiler will probably outperform that kind of assembly, so there is little point aside from the fun of it.
- Tade0 6y agoAs someone who used to work in banking software I can tell you where the 1MB of crap comes from - many banks create their web apps out of ready to use components, which are designed to be completely independent and this brings a huge weight penalty.
- captainbland 6y ago> So the improvement of Moore's law (RIP) ends up going to programmers' salaries If businesses demanded that everything be of optimal performance, developer salaries would most likely increase because that would increase demand for developer labour in the market without increasing its supply. And I know that many developers would be more than happy to do this (performance optimisation being one of these classic 'nerd sniping' tasks that really appeals to many programmers) but are simply not granted the time to. And there is a reason that hardly anyone's boss is telling them to eek out every bit and clock cycle: they can't afford it, or at least don't want to pay to do that. So the "benefit" of doing this actually lands squarely on the business, if you want anywhere to look for wasted resources.
- teleforce 6y agoThere is a new upcoming book by Matthew Justice to show and teach people of how computer really works: https://www.penguinrandomhouse.com/books/645954/how-computers-really-work-by-matthew-justice/ https://www.penguinrandomhouse.com/books/645954/how-computer... The book is still in writing stage thus not sure about the quality though but by looking at the table of contents it's looking very promising.
- feoren 6y agoOh spare me. If you went out to write a secure banking website in assembly code you'd come back in 20 years with something even more bloated than we have now. Why? Because the first thing you'd write is a higher-level programming language suited to actually building websites. Then you'd write a web framework on top of that web. Then you'd write a bunch of buggy, insecure crypto code. Et cetera et cetera until you've reinvented a much worse version of the stack we have now.
- m_mueller 6y agoI'm not convinced. Doug Engelbart's lab did essentially that with a dozen or so engineers within 2-3 years before the famous 1968 demo. I'm not saying we should do that for a banking website, but IMO when it comes to Frontend development there is an opportunity to rethink and start over, maybe on top of wasm.