- My thread pool class seems to be 5x faster than Qt's QThreadPool class... - 1 Update
- constexpr array in template class undefined at link time - 2 Updates
- reading random bytes from memory - 1 Update
- [OT] USA solar eclipse Aug.21.2017 - 4 Updates
- abort core dump message into a user file as log message - 1 Update
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Aug 29 08:37PM +0100 My thread pool class seems to be 5x faster than Qt's QThreadPool class... Qt QThreadPool test case: struct task : public QRunnable { int i; std::vector<int>& v; task(int i, std::vector<int>& v) : i{i}, v{v} {} void run() { v[i] = i; } }; int main(int argc, char *argv[]) { QThreadPool threadPool; std::vector<int> v; v.resize(100000); std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); for (int i = 0; i < 100000; ++i) threadPool.start(new task{i, v}); threadPool.waitForDone(); std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); std::set<int> s; for (auto n : v) s.insert(n); std::cout << "\ns: " << s.size() << "\ntime: " << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << "ms" << std::endl; } My neolib::thread_pool test case: int main() { neolib::thread_pool threadPool; std::vector<int> v; v.resize(100000); std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); for (int i = 0; i < 100000; ++i) threadPool.run([i, &v]() { v[i] = i; }); threadPool.wait(); std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); std::set<int> s; for (auto n : v) s.insert(n); std::cout << "\ns: " << s.size() << "\ntime: " << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << "ms" << std::endl; return 0; } Timing results: QThreadPool: 1051ms neolib::thread_pool: 222ms Not only is my thread pool class easier to use (lambdas instead of deriving of classes from QRunnable) it also appears to have significantly better performance. Game on for neoGFX being serious competition for Qt... :D /Flibble |
Clifford Heath <no.spam@please.net>: Aug 26 06:40AM +1000 On 26/08/17 00:01, Bo Persson wrote: > With C++17 you could get away with that if you declare it `inline > constexpr`. > Bo Persson Thanks Bo. I had figured that. But this is a template - there doesn't seem to be anywhere I can put a declaration. How would you write it? I'm still a bit of a newb with templates. Clifford Heath. |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Aug 25 11:53PM +0200 On 8/25/2017 10:40 PM, Clifford Heath wrote: > Thanks Bo. I had figured that. But this is a template - there doesn't > seem to be anywhere I can put a declaration. How would you write it? I'm > still a bit of a newb with templates. The ODR has a special rule for static members of class templates. You can define that member in the header file. Cheers & hth., - Alf |
Vir Campestris <vir.campestris@invalid.invalid>: Aug 25 08:53PM +0100 On 23/08/2017 06:18, Juha Nieminen wrote: > I doubt you'll find a mobile phone for which you can write your own software > which doesn't use hardward and an OS supporting (and using) memory > protection and mapping. I should have worded that differently. I'm pretty sure _all_ mobiles will have a memory controller, and definitely anything more capable. > you can even write software for them in C++, but from the average user's > perspective they are quite a rarity. They may be really common in certain > industries, but not amont the average programmer. I suspect quite a few of the people on this group aren't average programmers. I admit it's nearly 2 years since I used such a device. Andy |
Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem>: Aug 25 03:36AM -0400 On Thu, 24 Aug 2017 07:58:34 -0400 > Before the world was created, God had a plan for us for salvation. > It was to take us through school, to establish a baseline for our > creation, to teach us a lesson we could learn no other way. Why does God, who gave you and us life and free will according the Bible, need you to worship him? Why does an omnipotent entity need to be worshiped at all? Shouldn't an omnipotent entity need nothing from no one? Unless, his power is not inherent within his being, but comes from your worship of him. ... In which case, he's more likely Satan or Lucifer, or some lesser deity, or fallen angel, than God. > to do was diminish their negative, anti-God influence upon the > world, so that their false teaching would not exist in the many > generations to come, even out to thousands of years later. So, it's acceptable for God to give people permission to murder others, but it's unacceptable for humans, whom God gave free will to, to chose to murder others on their own using their free will, simply because God commanded men to follow the Ten Commandments? What was the point of having free will again, if we must obey God's commands and arbitrary laws, or be punished? That's not exactly free will is it? This is not only contradictory, but self-defeating for God. Did an omniscient being make a mistake by giving man free will? It's clear that he back tracked away from free will with the Ten Commandments. ... Man must follow the Ten Commandments or be punished, but God can give you permission to violate those same commandments on a whim. ... It would seem like God is making up this shit as he goes along. Doesn't it? One day, he tells people to follow the rules. The next day, he tells people to violate the rules. Is he Schizophrenic? Manic-Depressive? Alzheimer's? It's clear that there is no consistency in his commands, which would imply he's wishy-washy, indecisive, amoral, and/or a lunatic. Inconsistency prevents people from following leaders. An omniscient being would know this and wouldn't be inconsistent, unless the being was a child, or retarded, or unconcerned. If God is unconcerned, i.e., doesn't give a shit, then why bother to command us to worship him? > > was going to happen to us in advance. He didn't prevent it. He > > chose not to. I.e., he chose not to save us. > He gave the world Jesus Christ before He created the world. Did he? It's rather odd that Jews and Muslims don't believe that, but yet, they worship the EXACT SAME God as you. Now, how is that possible? If each major religion received the exact same Word of God from God, then why the extreme discrepancy? They don't even believe that Jesus Christ existed. Jesus Christ is not a part of their Word of God. ... Rod Pemberton -- Isn't anti-hate just hate by another name? Isn't anti-protesting just protesting by another name? Peace is a choice that both sides rejected. |
Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem>: Aug 25 04:54AM -0400 On Thu, 24 Aug 2017 08:20:30 -0400 > which build up to assemblies / machines, which build up to factories > of all kinds (biological, mechanical, industrial), which build up > to provide grander constructs. What makes you believe that a supreme entity is required to do this? I.e., why is it that you don't believe that complicated systems can build up naturally from the interaction of dynamic processes? You probably accept the scientific idea that planets were built up from smaller celestial objects moving about dynamically and colliding. Why you can't accept the same concept on the smaller scale of atoms or DNA without the need for God seems odd. > unique function, which come together to support the body, which > in turn supports our mind and ultimately by God's design also is > driven by spirit. Yes. I was staying away from science, since I doubted that you believed in it, at all, from your strong religious stance. However, you brought up DNA and atoms and the implications of Science thereupon. So, since you apparently believe that God is the source of DNA, let's some discuss DNA facts and contrast that with what the Bible says. Our DNA is 96% the same as a chimp. Did God recycle the chimpanzee's DNA from us? That would create a contradiction with Genesis, i.e., invalid time order since beasts were created before man. Did God recycle our DNA from the chimp? That too would create a contradiction with Genesis. In this contradiction, God would've lied about how he created us, i.e., not from scratch, not pure, not in his image, nor from mud, etc. Our intestinal tract matches that of a deep-sea worm. In fact, 70% of our DNA comes from that worm. Did God recycle us from a worm too or is evolution involved? Our mitochondrial DNA is not even part of our DNA, but comes from an ancient bacteria. How did it become a part of us? Do you believe that God put it there? Or, did Satan or Lucifer put it there to convince us that evolution is real? If that's true, why didn't God correct the evil manipulations? ... > The goal was the person inhabiting the body, not the body, yet > everything of marvelous design and assembly was put together to > produce that final form which we are able to inhabit and enjoy. It seems like that when your religious beliefs fail you, that you fall back to alternate explanations or ideologies that perhaps intertwine them with science, e.g., Creationism. > Our sun is one of many around the galaxy. Our galaxy is one of > many around clusters. Our cluster is one of many in this immense > universe. ... > what we can physically see here in matter, into the realm of the > spiritual world, which the Bible records is not inhabited by the > same decay we see here in the material world. That could be true, if we're a part of a computer simulation. That might also be true in a multidimensional universe. What does this have to do with God? Both of those could exist without the existence of God. Since you brought up science, how would God survive the Big Bang? I.e., Einstein's E=MC^2 prohibits the existence of anything in our universe which is neither energy or matter. This means that God would have to be made out of energy or matter. How did God survive the Big Bang without being destroyed? The massive conversion of energy into matter and vice-versa during the Big Bang would've even destroyed God as everything in this universe is subject to E=MC^2. Our universe is a closed system, at least presently. The only way God could continue to exist after the Big Bang is if he exists OUTSIDE our universe and is looking in, like a snow-globe or ant-farm. > or brick, a component of a larger structure. Perhaps there is > a plan for mankind to continue our education beyond this first > existence on the Earth. 1500 mile cube? Sorry, I have no idea what you're talking about. Googled 1500 mile cube. If Wikipedia is correct, biblical authors for different parts of the Bible record wildly different sizes for New Jerusalem, anywhere from about 70 feet to 1500 miles: https://en.wikipedia.org/wiki/New_Jerusalem#Description https://en.wikipedia.org/wiki/New_Jerusalem#Geometry > result, I am constantly learning with regards to its teachings, > and there is an internal confirmation which I get when I hear > things which are significant. That's called confirmation bias. It's one of many flaws in the ability of the human mind to reason logically. There's an entire page for it on Wikipedia. There are numerous cognitive biases, 103 logical fallacies, at least 57 behaviorial biases, etc. But, as a religious man, you probably don't believe in psychology either. > Seek the truth in your considering, Rod. It's all God asks. > Seek the whole truth, and He will do the rest in your life. Unfortunately, those who seek the Truth, usually find science which proves things, not religion which takes things on Faith, as the logical contradictions, inconsistency, and lunacy of the events and parables in the Bible can't be rationalized by the truly rational. Rod Pemberton -- Isn't anti-hate just hate by another name? Isn't anti-protesting just protesting by another name? Peace is a choice that both sides rejected. |
Ivan Shmakov <ivan@siamics.net>: Aug 25 03:15PM >> respective DNA by the virtue of belonging to the same species. > But that is the point. Then I share 99.5% of my DNA with my mother > which make the 96% a lot less impressive. Perhaps. Then again, science is boring. (In a way.) For perspective, you may want to compare human DNA to that of other species, such as dogs, rodents, lizards, fishes, etc. I'm pretty sure I saw such comparisons, although I won't necessarily vouch for their veracity. >> right. > If genes is correct, how can we be sure that a gene in a human codes > the same thing as in a chimp? The latter have 48 genes Chromosomes; each comprised of up to about a thousand of individual genes (AIUI.) > and humans 46. Therefore, a one-to-one correspondence is difficult. Basically, you get the whole sequence, and look for similarities. Or, rather, you let the computer do it for you. The point is that a specific sequence of triplets is bound to result in the same protein. And a specific protein nearly always is bound, by its very design, to serve the same or similar function. (Such as keratin being the principal component of human hair and fingernails, and also fur and claws and hooves of other mammals, etc.) The good part is that once you've established that locus 13 of chromosome ChA of species X maps to locus 37 of ChB of Y, it more or less stays the same across the individual specimens. (Or so I think.) And for sufficiently close species, nearby loci in one species tend to correspond to nearby ones in another. > And the same amino acid in two different proteins doesn't need to > perform the same task in both places, right? Neither is the same function call required to perform the same "task" in C. But when you see two mostly identical pieces of code, wouldn't you note the similarity? > statement that Einstein used 20% of his brain capacity whereas we > lesser mortals use only 10% of ours. I would really like to know > what 100% refers to in that case. Having a seizure? [1] [1] http://tvtropes.org/pmwiki/pmwiki.php/Main/NinetyPercentOfYourBrain -- FSF associate member #7257 58F8 0F47 53F5 2EB2 F6A5 8916 3013 B6A0 230E 334A |
Ivan Shmakov <ivan@siamics.net>: Aug 25 06:12PM >>> He must've known that our state of sin would result. If he knew of >>> this result in advance, since he is omniscient, how is this any >>> different from him actually planning for it to happen to all of us? Last time I've checked, "knowing about the consequences" and "being the cause thereof" were actually different things. > Bible, need you to worship him? Why does an omnipotent entity need > to be worshiped at all? Shouldn't an omnipotent entity need nothing > from no one? I'm by no means a theologian, and hence unsure whether this goes in line with the opinion of the Church Fathers, but here's my take on the issue at hand. It's an indirect answer, though. Why do we need to worship medics? I mean, when you climb a mountain and break a leg, why do you have to be taken to one of their shrines? If they're meant to help, why can't they help you then and there? Also, why do they need to DRAW YOUR BLOOD for their rituals? I mean, it's 21st century, man! Surely we're grown civilized enough to not need such barbaric customs! Or, alternatively. We've checked your samples, and we're sorry to inform you that you've got a disease. More like a hereditary condition, actually. Yes, it's fatal unless treated. Lifetime treatment it is, unfortunately. Indeed, we do offer treatment at our offices worldwide. No, the procedures are much experimental at this point, but we do plan to publish them within the next few millenia; we also hope to devise a way to actually cure it at that date. For now, there's only one doctor able to perform the treatment, and he's very busy; you see, this condition is quite widespread around the world. So I'm afraid you'd need to visit one of our offices regularly to receive the treatment. Of course, we're not forcing you to accept the treatment; this would go against medical ethics. Should you agree, however, you can fill the papers at any of our offices. Or, if the situation is dire enough, we can send our representative to the closest body of water near your place. Or, in the most severe cases, to your deathbed. Thank you for calling. We wish you well. [...] > others, but it's unacceptable for humans, whom God gave free will to, > to chose to murder others on their own using their free will, simply > because God commanded men to follow the Ten Commandments? Well, I'm not going to speak for the Church, but here's a scenario to consider. Suppose you have a few dozens of children (imagine having a harem if you need to), and you know for sure that two of them are set in their mind to kill most of the rest. You live with your family in the wilderness (some sci-fi movies and shows, set in space or in "post-apocalyptic" Earth, provide quite detailed picture for the situation, BTW), so there's no police, army or mental institutions to call for. Your solution? It's a different question why God did need the involvement of his chosen people, instead of going with the "Sodom Solution," but we can imagine that the latter would've been too harsh a punishment for the crimes committed. > commands and arbitrary laws, or be punished? That's not exactly free > will is it? This is not only contradictory, but self-defeating for > God. Did an omniscient being make a mistake by giving man free will? (Did you mean "omnipotent" here, BTW?) Remember that "could God create a stone so heavy that even He could not lift it?" paradox? Well, some argue that human soul /is/ such a stone (although St Augustine disagrees), in the sense that if you do not want God in it, then He won't enter. Whether that is to be considered a "mistake" is up to debate. > Commandments. ... > Man must follow the Ten Commandments or be punished, but God can give > you permission to violate those same commandments on a whim. Well, to be honest, those who follow the "Thou shalt not kill" commandment solely to avoid being punished, or think of it as a restriction of their free will, make me worry a lot. [...] >> He gave the world Jesus Christ before He created the world. > Did he? It's rather odd that Jews and Muslims don't believe that, > but yet, they worship the EXACT SAME God as you. It happens all the time; Lamarck and Darwin saw the same living world, yet came to two largely different takes on evolution. Also, one curious thing I've experienced personally. I remember once reading a response to my earlier post and finding more or less a direct insult in it. At which point I decided to take some time before replying. When I came back, I found that the other party was actually thanking me. So, the word that is said is not necessarily the one which one will end up hearing. The Christian take on the issue is that Jews were told of the coming of Jesus, but failed to see who they expected to be their literal king, the one to lead them in their war for independence, in a mere carpenter. Then, Islam is deemed to be largely inspired by Christianity. Or, well (that's a huge speculation, and a quote from Wikipedia as well): [There's] a remote, supreme Godhead, the Monad. From this highest divinity emanate lower divine beings, known as Aeons. The Demiurg, one of those Aeons, creates the physical world. Divine elements "fall" into the material realm, and are locked within human beings. This divine element returns to the divine realm when Gnosis, esoteric or intuitive knowledge of the divine element within is obtained. -- this kind of "Christianity." Except that, AIUI, Muhammad tried to excise much of the complexity. > Now, how is that possible? If each major religion received the exact > same Word of God from God, Huh? Who says that? > then why the extreme discrepancy? They don't even believe that Jesus > Christ existed. Quite the contrary; Jesus is venerated as one of the prophets in Islam, and at least his existence is acknowledged in Judaism. -- FSF associate member #7257 np. En Vie -- Apocalyptica 3013 B6A0 230E 334A |
kushal bhattacharya <bhattacharya.kushal4@gmail.com>: Aug 28 10:59PM -0700 On Monday, August 28, 2017 at 9:54:13 PM UTC+5:30, red floyd wrote: > from a C++ group, since the answer would be the same for C, Pascal, > or any other language. > You need to ask in a group that has "Linux" in its name. ok thanx i am going to ask this on a linux forum |
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