- Two vectors of ints or one vector of std::pair<int, int> ? - 4 Updates
- if cargo blocks - 19 Updates
- About C++ memory model and about Delphi and Freepascal.. - 1 Update
Paul <pepstein5@gmail.com>: Jan 17 10:31AM -0800 Suppose two vectors of ints are the same size -- say one million entries each. Comparisons need to be made between elements in the vectors -- for example it needs to be queried where A[780] < B[781]. The same information that can be stored in two vectors can also be stored as a single vector of std::pair<int, int>. Does a vector of pair<int, int> take up less space than two vectors? Is there any difference in performance between an enquiry to determine whether A[780].first < A[781].second compared to the above inquiry with separate vectors. Naively, I would think a std::pair approach is preferred. My guess is that it takes less space. Also, is there an architectural point to do with caches (my knowledge about this is hopelessly vague) that says that comparing A[k] with B[m] is slow because these two vectors reside in unrelated areas of memory whereas comparing A[k].first with A[m].second is faster because the A entries are in the same area of memory? Any thoughts? Thanks, Paul |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Jan 17 08:46PM +0100 On 17.01.2019 19:31, Paul wrote: > it needs to be queried where A[780] < B[781]. > The same information that can be stored in two vectors can also be stored > as a single vector of std::pair<int, int>. Or better, a vector of struct Good_name { int a; int b; }; > Does a vector of pair<int, int> take up less space than two vectors? Necessarily but it's a constant of a few bytes. > Is there any difference in performance between an enquiry to determine > whether A[780].first < A[781].second compared to the above inquiry > with separate vectors. Intuition often fails, so, try it. > areas of memory whereas comparing A[k].first with A[m].second is faster > because the A entries are in the same area of memory? > Any thoughts? Go for most clear code. And IMO that's neither separate vectors nor vector of `std::pair`. Cheers!, - Alf |
Jorgen Grahn <grahn+nntp@snipabacken.se>: Jan 17 08:58PM On Thu, 2019-01-17, Paul wrote: > Suppose two vectors of ints are the same size -- say one million entries each. > Comparisons need to be made between elements in the vectors -- for example > it needs to be queried where A[780] < B[781]. Did you mean A[780] < B[780]? > areas of memory whereas comparing A[k].first with A[m].second is faster > because the A entries are in the same area of memory? > Any thoughts? A vector of pairs takes up roughly as much space, and lookup in that one is nicer to the cache than two lookups in two vectors[0]. What bothers me is: is this really the main use case for these vectors? Are they created once, never updated, and only used to answer the question a[N] < b[N]? If not, you're going to make some other code uglier and slower. If yes, then a vector<bool> would be nicer to the cache. /Jorgen [0] Although I cannot say how much of a difference that would make. It depends on the overall access pattern. -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
Vir Campestris <vir.campestris@invalid.invalid>: Jan 17 09:57PM On 17/01/2019 19:46, Alf P. Steinbach wrote: > Go for most clear code. > And IMO that's neither separate vectors nor vector of `std::pair`. This.^^^ I doubt there would be much performance difference running through them serially. The only advantage could be if you kept picking out two entries at random - in this case it's probable the second one will be loaded in cache with the first with the pairs (or better structure) but if they aren't near each other you'll get two cache misses. And even then it's probably a very small effect. Premature optimisation (google it) is normally a bad thing. Andy |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 16 11:45PM On 16/01/2019 20:55, Rick C. Hodgin wrote: >> They are wrong because a) the Bible is false and b) your god doesn't >> exist. The problem is your inability to recognize these truths. > Is this what your religion of atheism teaches you Atheism isn't a religion; Christianity which you are trying to shill is a religion however. /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jan 16 04:04PM -0800 On Wednesday, January 16, 2019 at 6:45:26 PM UTC-5, Mr Flibble wrote: > > Is this what your religion of atheism teaches you > Atheism isn't a religion; Christianity which you are trying to shill is a > religion however. Atheism isn't a religion? Prove God does not exist then. Prove what you believe isn't a belief, but rather a fact. -- Rick C. Hodgin |
gazelle@shell.xmission.com (Kenny McCormack): Jan 16 11:22PM In article <q1od0k$6sp$2@dont-email.me>, >>> comfort have set are Is not God the and >> OK then. >Ever heard of scien_tology? YIKES! Yes. Ricky at least has that going for him. The knowledge that there are even whackier religions than the one he's selling. Of course, I don't really think of CoS as a religion. It is more of a self-help thing - like EST. But they (the runners of that scam) realize that calling themselves a religion has many advantages. -- The randomly chosen signature file that would have appeared here is more than 4 lines long. As such, it violates one or more Usenet RFCs. In order to remain in compliance with said RFCs, the actual sig can be found at the following URL: http://user.xmission.com/~gazelle/Sigs/BestCLCPostEver |
gazelle@shell.xmission.com (Kenny McCormack): Jan 17 03:48AM In article <23588ed4-c7d8-43be-a57e-9bd43fef8b3b@googlegroups.com>, >> religion however. >Atheism isn't a religion? Prove God does not exist then. Prove >what you believe isn't a belief, but rather a fact. Two words: Russell's Teapot. -- If it seems like I'm not responding to some moronic criticism that you've posted in response to one of my posts, be aware that I do not debate with idiots. It doesn't mean you've won anything... |
"Chris M. Thomasson " <ahh_f_it@crap.nothing>: Jan 16 09:04PM -0800 On 1/16/2019 3:22 PM, Kenny McCormack wrote: > Of course, I don't really think of CoS as a religion. It is more of a > self-help thing - like EST. But they (the runners of that scam) realize > that calling themselves a religion has many advantages. ZX_e__nu will eventually talk to you if you continually put money in the box. Wow, what a scam, think about what almost happened to your good friend Stan! Now, try to imagine a religion called A... A says: _______________ Try to live a good life, because there is this thing called Jail. If you want to donate to A, please give your money to a charity of your own choice. Red Cross? Wounded Warriors? A friend in need, ect... A says, try to do these things wrt money/donations when you can comfortably afford it. Never give your money away if you cannot afford to do so, family first! A says becoming rich is not bad. A says living a good life is a given for we should all strive for that simple thing. _______________ End Of Line. Does A sound a little more sane that other established religions, or, even crazier Kenny! ;^) |
David Brown <david.brown@hesbynett.no>: Jan 17 08:49AM +0100 On 17/01/2019 00:22, Kenny McCormack wrote: > Of course, I don't really think of CoS as a religion. It is more of a > self-help thing - like EST. But they (the runners of that scam) realize > that calling themselves a religion has many advantages. Have you heard how the CoS started? L. Ron Hubbard was a science fiction writer. He was not great, but not really terrible either. At a conference for science fiction writers, he was bemoaning to someone about how little money the writers make. They worked hard, wrote lots, met the deadlines for the various story magazines that were popular at the time, but got very little pay in the end. A colleague said, as a joke, that if you /really/ want to make money, you should start a religion. You get all the donations, it's tax free, and the US constitution and laws give you protection and freedom to say and do pretty much anything you want. As long as you call it a "religion", you can sell any idea to anyone, and keep all the profits. So Hubbard went home and started his pure science fiction "religion". |
"Öö Tiib" <ootiib@hot.ee>: Jan 17 12:52AM -0800 On Thursday, 17 January 2019 02:05:02 UTC+2, Rick C. Hodgin wrote: > > religion however. > Atheism isn't a religion? Prove God does not exist then. Prove > what you believe isn't a belief, but rather a fact. That argument is again displaying your dumbness. Fantasy beings can't leave evidence about their non-existence. So lack of belief into Yetis, Unicorns, Extraterrestrial astronauts, Tooth Fairies, Lord Cthulhu and whatever other fantasy beings is not religion. These may exist and can contact me any time they need to. Meanwhile I continue to doubt existence of those. |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jan 17 04:54AM -0800 On Thursday, January 17, 2019 at 3:52:46 AM UTC-5, Öö Tiib wrote: > That argument is again displaying your dumbness. > Fantasy beings can't leave evidence about their > non-existence. So, you're saying it's only a belief they don't exist, not by proof? > other fantasy beings is not religion. These may exist > and can contact me any time they need to. Meanwhile > I continue to doubt existence of those. You say they "may exist," but you don't know? Meanwhile, you do continue to believe they don't exist? Did I understand your response correctly, that it is only belief you have that these things do not exist? No proof? -- Rick C. Hodgin |
gazelle@shell.xmission.com (Kenny McCormack): Jan 17 02:29PM In article <20462659-61e5-4bb6-8ba1-41bbb3c60a72@googlegroups.com>, Rick C. Hodgin <rick.c.hodgin@gmail.com> wrote: Nothing of value. -- If Jeb is Charlie Brown kicking a football-pulled-away, Mitt is a '50s housewife with a black eye who insists to her friends the roast wasn't dry. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 17 05:37PM On 17/01/2019 00:04, Rick C. Hodgin wrote: >> religion however. > Atheism isn't a religion? Prove God does not exist then. Prove > what you believe isn't a belief, but rather a fact. Atheism is simply the lack of belief in deities and as such doesn't claim anything that requires proving. My claims that the Bible is false and that your god doesn't exist was not atheistic in nature as these claims are based on knowledge not belief: I know for a fact (this is not a belief) that your Bible is false and as the existence of your god is predicated on your Bible being true I know for a fact (this is not a belief) that your god does not exist. /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jan 17 10:16AM -0800 On Thursday, January 17, 2019 at 12:37:14 PM UTC-5, Mr Flibble wrote: > know for a fact (this is not a belief) that your Bible is false and as the > existence of your god is predicated on your Bible being true I know for a > fact (this is not a belief) that your god does not exist. You say "I know for a fact..." Prove it. Show me how you know this conclusively beyond belief, and into solid demonstrable fact. -- Rick C. Hodgin |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 17 06:40PM On 17/01/2019 18:16, Rick C. Hodgin wrote: >> fact (this is not a belief) that your god does not exist. > You say "I know for a fact..." Prove it. Show me how you know this > conclusively beyond belief, and into solid demonstrable fact. Evolution falsifies Genesis. Evolution being a fact is only denied by fucktards such as yourself. And before you pull out AGAIN your tedious counter-claim: no there are no dinosaur fossils with blood containing dinosaur DNA in them: those fossils were subsequently found to have foreign contamination. /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jan 17 10:46AM -0800 On Thursday, January 17, 2019 at 1:41:03 PM UTC-5, Mr Flibble wrote: > > You say "I know for a fact..." Prove it. Show me how you know this > > conclusively beyond belief, and into solid demonstrable fact. > Evolution falsifies Genesis. Evolution has not been proven. It is a theory. In addition, genetic research into how DNA works disproves evolution as being a viable possibility. There are simply too many things at the molecular level which have to happen to allow changes to exist without new information, without intelligent design, by any kind of trial-and-error system. Big Bang -> universe soup -> cooling -> pools of goo -> life ... That is a theory that has not stood up to rigorous scientific examination. The only type of changes seen are adaptation within a kind, such as dog breeds, or dogs that are dropped off in colder climates having longer fur in a few generations. That's not evolution, that's using the natural adaptive abilities already present in the DNA to adapt. A dog could never evolve a heater, for example. It can only produce what it's already programmed to produce. You're believing lies as though they were truth, Leigh. Where is your proof? -- Rick C. Hodgin |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 17 06:54PM On 17/01/2019 18:46, Rick C. Hodgin wrote: >>> conclusively beyond belief, and into solid demonstrable fact. >> Evolution falsifies Genesis. > Evolution has not been proven. It is a theory. Wrong. Evolution is not a theory. The theory of evolution *is* a theory and that theory attempts to explain evolution. The fact that evolution happens is accepted fact. I suggest you read up on how theories relate to facts; you can start here: https://en.wikipedia.org/wiki/Evolution_as_fact_and_theory You also seem to think that scientific theories can be proven so again you are showing your ignorance: it is not possible to prove ANY scientific theory (only mathematical theories can be proven) however scientific theories can be falsified which is the beauty of science: it evolves as new evidence (facts) come to light. [snip tl;dr] /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jan 17 10:57AM -0800 On Thursday, January 17, 2019 at 1:54:38 PM UTC-5, Mr Flibble wrote: > theory (only mathematical theories can be proven) however scientific > theories can be falsified which is the beauty of science: it evolves as > new evidence (facts) come to light. Evolution is no fact. Adaptation is fact. But no dog has EVER produced a non-dog, not in the natural world, not in the lab. Evolution does not exist. Adapatation does. Adaptation is part of intelligent design. What you believe in is the Big Bang -> pre-universe -> hot-universe -> cool universe -> cooling Earth -> goo -> life. That is a natural sequence without God, without intelligent design. That has never been proven. It is a theory. It is not real sci- ence. It is a religion because it's a belief. -- Rick C. Hodgin |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 17 07:01PM On 17/01/2019 18:57, Rick C. Hodgin wrote: > That is a natural sequence without God, without intelligent design. > That has never been proven. It is a theory. It is not real sci- > ence. It is a religion because it's a belief. LOL. /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 17 07:22PM On 17/01/2019 18:57, Rick C. Hodgin wrote: > That is a natural sequence without God, without intelligent design. > That has never been proven. It is a theory. It is not real sci- > ence. It is a religion because it's a belief. LOLWUT. And Satan invented fossils, yes? You silly man. /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jan 17 11:41AM -0800 On Thursday, January 17, 2019 at 2:22:18 PM UTC-5, Mr Flibble wrote: > > That has never been proven. It is a theory. It is not real sci- > > ence. It is a religion because it's a belief. > LOLWUT. And Satan invented fossils, yes? You silly man. God created everything. Satan rebelled against God, and came to Earth and deceived man into sinning. With that sin came spiritual death so all we now know is flesh. God worked with us in our sin-fallen state, even going so far as to completely start over with a preacher and his family at one point, yet sin continued. God gave man the Law to guide him against sin, to keep his flesh occupied on rigor, but even then sin entered in. Jesus finally came to take our sin away and restore us to the way and nature God intended for us before sin entered in. He now gives that freedom and salvation away for free, just for the asking. Our spirit nature is restored for all whose sin is forgiven, and we have a future which is secure. I teach you these things so you can know. -- Rick C. Hodgin |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 17 07:46PM On 17/01/2019 19:41, Rick C. Hodgin wrote: > Our spirit nature is restored for all whose sin is forgiven, and > we have a future which is secure. > I teach you these things so you can know. Nonsense: a) your bible is provably false and b) your god which is predicated on your bible being true is also false. /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Horizon68 <horizon@horizon.com>: Jan 16 04:00PM -0800 Hello, About C++ memory model and about Delphi and Freepascal.. The abstract machine in the C++98/C++03 specification is fundamentally single-threaded. So it is not possible to write multi-threaded C++ code that is "fully portable" with respect to the spec. The spec does not even say anything about the atomicity of memory loads and stores or the order in which loads and stores might happen. Of course, you can write multi-threaded code in practice for particular concrete systems – like pthreads or Windows. But there is no standard way to write multi-threaded code for C++98/C++03. The abstract machine in C++11 and above is multi-threaded by design. It also has a well-defined memory model; that is, it says what the compiler may and may not do when it comes to accessing memory. The default mode for atomic loads/stores in C++11 and above is to enforce sequential consistency. This just means all loads and stores must be "as if" they happened in the order you wrote them within each thread, while operations among threads can be interleaved however the system likes. So the default behavior of atomics provides both atomicity and ordering for loads and stores. Now, on a modern CPU, ensuring sequential consistency can be expensive. In particular, the compiler is likely to emit full-blown memory barriers between every access here. But if your algorithm can tolerate out-of-order loads and stores, you can use memory_order_relaxed. So, bottom line. Mutexes are great, and C++11 standardizes them. But sometimes for performance reasons you want lower-level primitives (e.g., the classic double-checked locking pattern). The new standard provides high-level gadgets like mutexes and condition variables, and it also provides low-level gadgets like atomic types and the various flavors of memory barrier. So now you can write sophisticated, high-performance concurrent routines entirely within the language specified by the standard, and you can be certain your code will compile and run unchanged on both today's systems and tomorrow's. Although, unless you are an expert and working on some serious low-level code, you should probably stick to mutexes and condition variables. And now about Delphi and Freepascal(because as you have noticed i am working with C++ and with Delphi and Freepascal) As you have noticed i have invented many scalable algorithms and there implementations, and they are now working on x86 architecture, and even if Delphi and Freepascal have no memory model as the one of C++11, i will soon make my scalable algorithms implementations in Delphi and Freepascal and all my Delphi and Freepascal softwares "portable" by first using a portable CLH lock that i will write in C and using it from Delphi and Freepascal and second by using the functions of TInterlocked class of Delphi and correspondent functions in Freepascal, and after that all my Delphi and Freepascal projects will become portable on other architectures than x86, and thus my Delphi and Freepascal scalable algorithms implementations and all my Delphi and Freepascal softwares will permit Delphi and Freepascal to become really much more capable and powerful. Here is my scalable algorithms that i have invented that i will make portable: - Scalable MLock - Scalable AMLock - Scalable SeqlockX - Many kind of Scalable RWLocks that are starvation-free - Scalable Asymmetric Reader-Writer Mutex that is starvation-free - Scalable Rwlocks that are starvation-free using scalable counting networks - Scalable Hashtable - Scalable Parallel Varfiler - Fully scalable Threadpool - Scalable reference counting with efficient support for weak references - Scalable FIFO queues both node-based and array-based - ParallelFor() that scales very well. You can find many of my scalable algorithms and there implementations in C++ and Delphi and Freepascal on my following website: https://sites.google.com/site/scalable68/ Thank you, Amine Moulay Ramdane. |
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