Code Comments
Programming Forum and web based access to our favorite programming groups.In article <aa56v39181p15lg3chqrimv483b8402tsn@4ax.com>, Razii <DONTwhatevere3e@hotmail.com> wrote: >On Tue, 1 Apr 2008 20:53:36 -0700 (PDT), lbonafide@yahoo.com wrote: > > > >:) Not sure why I am responding to what is mostly trolling but I'll take your smiley and respond to face value. >Where is the HashMap container in c++ standard library? std::tr1::unordered_map >It makes a big difference in speed if you use std::map vs HashMap in >some situations. So where is the HashMap? There's a key in the above sentence: "in some situation" In many situation, both would do the job fine. In some situation, a hash map is better. In some situation, a balanced tree map is better In some situation, a hash map is totally unacceptable. In some situation, a balanced tree map is totally unacceptable. Learning to figure out in which of the above situation you are is a very important part of programming. What are your requirements? What are the typical performance requirements? What are the worst case scenario requirements? There are fairly fundamental performance differences between balanced tree algorithm and hash algorith, one of the potentially important one is worst case scenario search complexity. If like the pseudo-benchmarks you write, you are only concerned about best performance in one particular situation, the best solution might be different than if you must make sure that your application performs well in most cases and never ever perform worse than a set target. If you are interested to learn, have a look at: http://en.wikipedia.org/wiki/Hash_table http://en.wikipedia.org/wiki/Red_black_tree Note that the C++ standard doesn't requires that std::map be implemented as a red-black tree. It only states complexity requirements. Library implementors are free to choose whatever algorithm they wish as long as it meets the requirements. Yan
Post Follow-up to this messageOn Apr 2, 12:16 am, Razii <DONTwhatever...@hotmail.com> wrote: > On Tue, 1 Apr 2008 20:53:36 -0700 (PDT), lbonaf...@yahoo.com wrote: > > :) > > Where is the HashMap container in c++ standard library? > > Got it this time? > > It makes a big difference in speed if you use std::map vs HashMap in > some situations. So where is the HashMap? Two questions: Why did you troll this thread? Have you ever written a piece of production software in your life?
Post Follow-up to this messageOn Wed, 2 Apr 2008 04:47:50 -0700 (PDT), lbonafide@yahoo.com wrote: >Have you ever written >a piece of production software in your life? Nor did I ever claim that's what I do for living :)
Post Follow-up to this messageOn Apr 2, 7:05 am, Razii <DONTwhatever...@hotmail.com> wrote: > On Wed, 2 Apr 2008 04:47:50 -0700 (PDT), lbonaf...@yahoo.com wrote: > > Nor did I ever claim that's what I do for living :) That's obvious, as you seem to be capable of toy programs only and don't seem to understand the complexities of developing robust software that performs well. Why don't you include Python in your benchmarks? I'm sure Java and C+ + would beat the fool out of it, and yet it is used by Google, YouTube, NASA, Industrial Light and Magic, and many other large organizations to real production work. Just the same, you could burst in their front doors waving your arms like a maniac telling them that it is too slow. Maybe they'd listen to you. Maybe they'd call security. I think it's worth a shot.
Post Follow-up to this messageOn Wed, 2 Apr 2008 05:22:22 -0700 (PDT), lbonafide@yahoo.com wrote: >Why don't you include Python in your benchmarks? Why don't you? Let me see a Python and Perl version. >I'm sure Java and C+ >+ would beat the fool out of it, and yet it is used by Google, >YouTube, NASA, Industrial Light and Magic, and many other large >organizations to real production work. I never claimed speed is everything, but that's the topic we have been discussing, for fun obviously. >Just the same, you could burst >in their front doors waving your arms like a maniac telling them that >it is too slow. Maybe they'd listen to you. Maybe they'd call >security. I think it's worth a shot. now that's funny :) How come you have FIDE in your email?
Post Follow-up to this messageOn Apr 2, 3:20 am, Ian Collins <ian-n...@hotmail.com> wrote: > June Lee wrote: > No, there's the C++ standard library, which includes the C > standard library. > Anything else is platform specific. > There are several cross-platform libraries that are in > widespread use, boot being one. So which is it: anything else is platform specific, or there are several cross-platform libraries? And I'm pretty sure you mean Boost, not boot. (Not that that's the only cross-platform library around.) -- James Kanze (GABI Software) email:james.kanze@gmail.com Conseils en informatique orient=E9e objet/ Beratung in objektorientierter Datenverarbeitung 9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34
Post Follow-up to this messageIn article <v1s6v3l536jtiffbjjemehrlcop3j3mhfl@4ax.com>, Razii <DONTwhatevere3e@hotmail.com> wrote: >On 02 Apr 2008 11:11:51 GMT, ytrembla@nyx.nyx.net (Yannick Tremblay) >wrote: > > >WC2.cpp(12) : fatal error C1083: Cannot open include file: >'tr1/unordered_map': No such file or directory Read your platform documentation and figure out if it supports TR1. If not, obtain a TR1 library (dinkumware comes to mind) > >In this case, word counting app, the speed will improve greatly by >using hashmap (that's my guess). The hashmap can be converted back to ^^^^^^^^^^^^^^^^^ Don't you see a problem in the above? Haven't you read what peoples have been trying to tell you? Here's one again: "Don't guess. Measure" >ordered at the end by transferring it into ordered map. Might be in the general case. Howver, if you write a word sorter using a hash table, it is possible that you would encounter data that would trigger a worse case scenario performance. So you could write your program, claim it is very fast and I could make it incredibly slow simply by feeding it specifically chosen data. Not really something you'd want to expose to the world. Interestingly, you deleted the rest of my hash vs balanced tree comparaison and links that explain that.
Post Follow-up to this messageRazii wrote: > Where is this HashMap container in the Standard C++ Library? Poor "Bo > Persson" can't find it. Something he needs to speed up the word > counting benchmark, which for now is more than 2 times slower. *plonk* Brian
Post Follow-up to this messageOn 02 Apr 2008 14:44:59 GMT, ytrembla@nyx.nyx.net (Yannick Tremblay) wrote: >In article <v1s6v3l536jtiffbjjemehrlcop3j3mhfl@4ax.com>, >Razii <DONTwhatevere3e@hotmail.com> wrote: > >Read your platform documentation and figure out if it supports TR1. >If not, obtain a TR1 library (dinkumware comes to mind) How is it standard when VC++ doesn't have it? > ^^^^^^^^^^^^^^^^^ >Don't you see a problem in the above? >Haven't you read what peoples have been trying to tell you? >Here's one again: "Don't guess. Measure" I have already tested this on java version and using ordered map made it much slower. > >Might be in the general case. Howver, if you write a word sorter >using a hash table, it is possible that you would encounter data that >would trigger a worse case scenario performance. So you could write >your program, claim it is very fast and I could make it incredibly >slow simply by feeding it specifically chosen data. Not really >something you'd want to expose to the world. I doubt it's that easy to trigger worse case scenario. You will need to read hashing algorithm and then write a bible size book with specifically chosen data. >Interestingly, you deleted the rest of my hash vs balanced tree >comparaison and links that explain that. There was nothing new in the rest of your post. I have seen Wikipedia's articles before.
Post Follow-up to this messageRazii wrote: > On 02 Apr 2008 14:44:59 GMT, ytrembla@nyx.nyx.net (Yannick Tremblay) > wrote: > > > How is it standard when VC++ doesn't have it? Maybe if you stick with programing, you'll come to understand that MS is the poster child for disregarding standards. Ever heard of the phrase embrace and extend? > > > I have already tested this on java version and using ordered map made > it much slower. So the answer is "no I don't get it"? > > > I doubt it's that easy to trigger worse case scenario. You will need > to read hashing algorithm and then write a bible size book with > specifically chosen data. I'll go out on a limb here and guess that you're self taught. You might want to consider a course in algorithms if you're really interested in programming. You clearly seem concerned with appearances as evidenced by your taunts. You can't even imagine how much it would improve your standing with programmers if you could replace "doubt" and "guess" with a clear, correct, and concise analysis of an algorithm. > > > There was nothing new in the rest of your post. I have seen > Wikipedia's articles before. And your reading skills have already been clearly demonstrated. > >
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.