- accelerate - 3 Updates
- Sometimes optimization *does* matter - 1 Update
- Overuse of 'auto' - 7 Updates
Paavo Helde <eesnimi@osa.pri.ee>: Dec 19 09:17PM +0200 19.12.2022 18:46 Scott Lurndal kirjutas: > requirements? Even a ringworld would take more energy than it would > produce just to build and put in orbit. How far out does it need to be > to ensure that the energy density at any point is habitable? You cannot argue such things by relying on the current level of techonology. Hundred years ago it was pretty expensive to store one bit of information electrically (an electromechanical relay was a complex device), today it's something like 0.00000002 cents per bit. Moreover, if someone told them about terabytes of memory, they would have laughed and said there is not enough copper to make so many relays, and anyway the mechanical failure rate would have been such that the system would break down immediately after starting operation, so mission impossible. And this is just 100 years. For building something you don't need energy, you just need to place the atoms in the correct position. When 3D printing has advanced enough, you can build whatever, including a clone of yourself, by placing atoms in correct location in space. At next step, you would place protons and neutrons in correct place in space, creating any needed atoms. For saving cost, maybe putting neutrons first, then decaying half of them into proton+electron pairs? The price of gold could become something like 0.00000002 cents per ton. I say, you are just lacking imagination ;-) |
scott@slp53.sl.home (Scott Lurndal): Dec 19 08:53PM >> to ensure that the energy density at any point is habitable? >You cannot argue such things by relying on the current level of >techonology. I'm not relying on any current technology. There is no current technology capable of producing the energy or materials necessary to create a dyson sphere or a ring. However, it is an interesting exercise to attempt to compute exactly how much material and energy would be required to build such a construct. For example, a MIT study recently looked at the idea of a sunshade to help ameliorate planetary warming. The upshot was that the shade needed to span millions of square kilometers and would cost multiple tens of trillions of dollars to build and emplace in (relatively) stable earth-sun L1 orbit. >the mechanical failure rate would have been such that the system would >break down immediately after starting operation, so mission impossible. >And this is just 100 years. The growth in energy consumption for the past 150 years has averaged 2.8% per annum. That's an exponential growth curve[*] which is not viable over the long term (even if we had an infinite supply of clean energy), simply because energy == heat. Waste heat. At the 2.8% rate, in less than four centuries, the surface temperature of the earth would be at the boiling point of water just from waste heat alone. This is simple physics, albeit argumentum ad absurdum, since we'll run out of economically extractable stored solar energy (gas, oil, coal) within the next generation, if not sooner. [*] Soi disant "hockey stick". To build a fleet of nuclear reactors to replace the stored solar energy (said store built up over hundreds of million years) would require some 30,000 reactors to be built (assuming that energy growth stops) given the current 20TW world-wide electricity consumption plus 50% to account for electricity to replace transportation fuels and fuels used to make steel, concrete, aluminum and fertilizer and assuming that growth in energy consumption levels out. Most of the world economies are predicated on growth. The more the better. For the economy to grow, energy consumption by the economy will grow. To a certain extent, improved efficiencies will offset the growth in consumption, to a degree, but even that has an upper limit imposed by thermodynamics. This too can't last forever. >For building something you don't need energy, you just need to place the >atoms in the correct position. How do you move those atoms around without energy? >When 3D printing has advanced enough, you >can build whatever, including a clone of yourself, by placing atoms in >correct location in space. Where do you get those atoms, and how do you place them without using energy to move them? >neutrons first, then decaying half of them into proton+electron pairs? >The price of gold could become something like 0.00000002 cents per ton. >I say, you are just lacking imagination ;-) No, just grounded in reality, sadly. |
Paavo Helde <eesnimi@osa.pri.ee>: Dec 19 11:19PM +0200 19.12.2022 22:53 Scott Lurndal kirjutas: >> For building something you don't need energy, you just need to place the >> atoms in the correct position. > How do you move those atoms around without energy? We know since Newton that moving does not require energy. It's acceleration what does. If a particle is at time=t1 stationary in some frame in some spot 1, and in a later time=t2 stationary relative the same frame in some other spot 2, it will have the same potential and kinetic energy and there is no fundamental reason to claim that some energy has to be spent when moving it from spot 1 to spot 2. In our everyday experience some energy is almost always lost on thermal interactions, but if we manage to move the atom in a state of quantum coherence (like in superconductivity or super-viscosity), no energy would be lost. That would be the ideal. In reality most probably some energy would be needed, but we have no idea how much, and second, one cannot exactly say that the place where one might construct the Dyson sphere is lacking in energy - rather the opposite. That's why one would want to construct it there in the first place. |
Marcel Mueller <news.5.maazl@spamgourmet.org>: Dec 19 10:11PM +0100 Am 19.12.22 um 10:33 schrieb Juha Nieminen: > a big deal. A quick&dirty implementation is just fine." > But what about an unoptimized quick&dirty implementation taking > *one month* for a task that can be computed in *less than a second*? I had no such case so far. But I remember an optimization of a monthly job from 3 weeks - it was challenging to get an interval where none of the required computers had some maintenance - to some minutes. > Sometimes optimization *does* matter. Sometimes expertise in programming > and algorithms does make quite a difference. It can be the difference > between the program running for a month vs. running less than a second. I prefer to use optimization by default, especially when the additional effort is moderate. Sooner or later many of the quick and dirty solutions need to be refactored. This is more work than doing it immediately and invalidates testing. Sometimes late optimizations also require public API changes, which can cause significant additional effort in other teams. I am sure, that several people will disagree and say that choosing appropriate data structures and algorithms by default is waste of time. But this simply does not fit to my 4 decades of programming experience. Marcel |
Keith Thompson <Keith.S.Thompson+u@gmail.com>: Dec 19 10:28AM -0800 Juha Nieminen <nospam@thanks.invalid> writes: [...] > Maybe, *maybe*, 'i' is acceptable in *very* short one-liner loops. > (But even then... Why? What's the advantage? I see no advantage.) The advantage is that using 'i' follows an established convention that has been in use for the better part of a century. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for XCOM Labs void Void(void) { Void(); } /* The recursive call of the void */ |
David Brown <david.brown@hesbynett.no>: Dec 19 07:30PM +0100 On 19/12/2022 17:55, Ben Bacarisse wrote: > consider "index" no better than "i" when the scope is very short (as it > usually should be) and when the use is general, but "index_of_largest" > might be better in a less general context. I think your preference here is shared by the majority of programmers (excluding those that write with a disregard for legibility). > Brevity-over-clarity is always bad, almost by definition. We should try > to avoid terms like "overly short names" and "excessive abbreviation" in > this kind of debate because they beg the question. Yes. The whole thread is based on a similar circular argument, or a tautology - of course /overuse/ of "auto" is bad, as is /overuse/ of anything. |
Keith Thompson <Keith.S.Thompson+u@gmail.com>: Dec 19 10:36AM -0800 > this is the first time in my life I hear that "thick skull" is an > insult. It just means "stubborn". Unless you think "stubborn" is > also an insult. I am a native English speaker. Yes, "Get into your thick skull ..." is an insult. > I myself can be quite stubborn at times. I don't find that very > insulting. > Maybe you also have a thin skin in addition to a thick skull... Also an insult. > And this post of yours did nothing to dispel my notion that you are > just arguing for the sake of arguing. Nobody in their right mind > would say that clearer variable and function naming is a bad thing. Nobody here is saying "clearer variable and function naming is a bad thing". Most people here disagree with you about what names are clearer. You now seem to believe that a large number of participants here are disagreeing with you because we're "just arguing for the sake of arguing", that we're ganging up on you and disagreeing with your obviously correct points just because. Is that plausible? Do you think there's something about you personally that induces people to behave this way? There isn't. No doubt some of the counterarguments are influenced by the vehemence of your own arguments, but I haven't seen any indication here that anyone -- including you -- is arguing insincerely. A lot of people here *understand* what you're saying and *disagree* with you. I won't ask you to get that through your thick skull, but please consider the possibility. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for XCOM Labs void Void(void) { Void(); } /* The recursive call of the void */ |
Paavo Helde <eesnimi@osa.pri.ee>: Dec 19 10:03PM +0200 19.12.2022 17:24 Juha Nieminen kirjutas: > is why I have been repeating that length doesn't matter). You have > to choose the words being used for the name so as to convey clearly > to the reader what it is. Agreed. > discussion. Here I'm not extraordinarily strongly opinioned. Might > be more relevant if there are several versions of the function for > different string types.) Ah, I have written a bunch of these conversion functions, and pondered about their names quite a lot. This is what I have arrived at: Utf2Win - UTF-8 to UTF-16 Utf2WinFileName - same, plus converts slashes to backslashes Win2Utf - reverse Win2UtfFileName - reverse These names are fine for my taste, but probably too short for yours. These names reflect their usage context, namely converting strings for the Windows API and back. >> He also believed in 76-char line limit. > There's really no reason to use such a limit, and there hasn't really been > in a rather long time. I could not get clear reasons about this from him. Probably he felt himself good after he managed to squeeze its code into this absurd limit. I recall some his code with deeply nested if-else blocks where the lines contained of 50 chars of indentation and 20 chars of code. > but most of those words don't really clarify what this is doing. Maybe > it's clearer in context, but all by itself it's hard to guess what that > 'type1' or 'helper1' is supposed to convey. No, it was not better in context. There are no type2 or helper2. There are also no sets and no cardinalities involved in this part of the program. A better name for that function would be ThrowIfNotEqual. Though I do not see any need for such a function, I would just throw an exception where needed. |
scott@slp53.sl.home (Scott Lurndal): Dec 19 08:38PM >> I would prefer if the function actually says what it's converting from, >> like for example >> 'convert_to_utf8_from_utf16()' For this, I'd probably use c_utf8 string; string += c_utf8::from_utf16(utf16arg); But only if I ever programmed on windows, which will never happen. |
Paavo Helde <eesnimi@osa.pri.ee>: Dec 19 10:45PM +0200 19.12.2022 20:04 Juha Nieminen kirjutas: > I have stated in another post that my principle is that full English > words should be used, but an exception can be made with acronyms that > are universally used and understood (such as GPS, HDMI, cos, etc.) You are kidding, right? Most of people I know would have no idea what HDMI or cos mean (although supposedly they all should have had learned the latter in school). With GPS it's maybe better, but still they think it contacts the satellite first. There is no such thing as "universally used and understood". When my company sends me the quarterly newsletter, it is choked up with TLA-s whose meaning I have no idea of. I'm sure the authors are thinking these are all universally used and understood. It's all about the context. When a mathematician writes an article to fellow mathematicians working in the same field, the phrase "it clearly follows" means 1 - 10 pages of proofs left out, which the reader is expected to substitute, by the context, and which is left out from the paper because it would distract the reader from the main points. |
Paavo Helde <eesnimi@osa.pri.ee>: Dec 19 10:54PM +0200 19.12.2022 22:38 Scott Lurndal kirjutas: > For this, I'd probably use > c_utf8 string; > string += c_utf8::from_utf16(utf16arg); And what does 'c_' mean? Apparently another "universally understood abbreviation" which I would not know without context. |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment