Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.lang.java.programmer > #5822
| From | blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: StringBuilder Difficulties |
| Date | 2011-07-02 18:33 +0000 |
| Organization | None |
| Message-ID | <9796kgFoijU3@mid.individual.net> (permalink) |
| References | <c4tk07dv1pq7u8k32qd6b7o1brc2rj8r30@4ax.com> <6cqp07tiug2nu8u6ififvvek1694fkpfi1@4ax.com> <976q3jF3etU2@mid.individual.net> <e9ps07h56utkftkp8fcarm7uhkk5t999le@4ax.com> |
In article <e9ps07h56utkftkp8fcarm7uhkk5t999le@4ax.com>, Gene Wirchenko <genew@ocis.net> wrote: > On 1 Jul 2011 20:47:47 GMT, blmblm@myrealbox.com > <blmblm.myrealbox@gmail.com> wrote: > > >In article <6cqp07tiug2nu8u6ififvvek1694fkpfi1@4ax.com>, > >Gene Wirchenko <genew@ocis.net> wrote: > >> On 30 Jun 2011 20:30:00 GMT, blmblm@myrealbox.com > >> <blmblm.myrealbox@gmail.com> wrote: > >> > >> [snip] > >> > >> >A general comment: I'm inclined to agree with the people who are > >> >saying that in general it seems like you're trying to write [name > >> >of your favorite language] programs in Java, and in the long term > >> >that seems less optimal than trying to grok the Java mindset. > >> > >> My mindset is that I want to get my work done. I do not care > >> about the Java mindset except as it helps me get my work done. > > > >Yes, and if you were going to do a lot of programming in Java it > >would seem to make sense to adapt to the local customs, so to speak. > >Not to do so seems to me like fighting with your tools, which, well, > >I do it too sometimes, but it does get in the way of getting stuff > >done. > > My tools include manyyears of experience programming. I do not > think that Java is such a precious snowflake -- the same is true of > any language -- that I should have to throw all that experience away > in order to use the language. As another poster has responded, I'm not convinced that's what you're being asked to do (though you obviously feel otherwise). It seems to me that one of the things one learns from doing a lot of coding in a lot of languages is recognizing when something is the same as what you've done before, just with different syntax, and when it's different. <shrug> > >> >I think part of it may be struggling with the object-oriented > >> >paradigm, but part of it may just be coming to terms with the fact > >> > >> No, I am experienced with OOP. > > > >Huh. Well, with all due respect .... > > > >I'd have said otherwise given that all of the variables and methods > >in your TimingTesting program (the version I tried revising) seem > >to be static (except the local variables). I'm also puzzled by why > >that program duplicates so much code, when you could have factored > >out the parts that are different using objects-as-code-wrappers. > >But maybe the O-O languages you've used before don't make you do > >that, and adapting to that particular Java idiom seemed not worth > >the trouble. > > Oh, I asked about that. One apparently can not pass a function > pointer parameter as in C. The ways that were posted involved lookup > every time AFIACS and I judged that it might swamp what I was > measuring (checking if a character were in a set). So, to my chagrin, > I had to go with cut-and-paste. Without experimenting to find out, of course .... It seems to me that virtual method invocations are so common in Java that they would be well-optimized. But if you want to claim that the code you eventually hope to produce won't have one, well, yeah, that's true, so maybe it matters. Then again, wouldn't a similar argument apply to C with function pointers? Maybe not. I don't seem to be able to think this through as carefully as I'd like. Anyway, I was curious, so I ran your code and my revision [1], and the results were -- surprising [2]. I noticed, by the way, that all three of your parse methods make a call to SequentialSearch, assigning the result to a variable that apparently isn't used. Thinking that *might* be a mistake, I also tried your code and my revision with that possibly-extra call removed. [1] Message-ID: <96k6atFt60U2@mid.individual.net> [2] I tried this on several different systems, all Fedora Linux running Java 1.6.0_21 but different hardware and different releases of Fedora. I was going to include results here, but in trying the experiment on additional systems I'm less and less convinced the results would mean anything without my putting more effort into it than I'm up for. (Usually when I'm timing something I try it twice, and if results are close enough I don't bother with additional trials. In this case results of two trials were just different enough for me to think I'd need to do more to get meaningful results.) Briefly, though .... : Your code was fairly (but not 100%!) consistent in showing treeset-based search to be fastest, followed by binary search and then sequential search, though sometimes the difference between sequential and binary was small. My code was -- well, this is where it's surprising. On most of the systems where I tried it, treeset search was fastest, but sequential search was faster than binary search; on one system, however, the order was as for your code. Your code was pretty consistently faster than mine, though usually not by a lot (less than 1%). > >> >that Java is, as I think Patricia Shanahan said not long ago > >> >(possibly in another thread), that Java is just plain verbose. > >> > >> Well, I posted about the verbosity earlier and got flak over it. > >> > >> >But I have some sympathy with the desire just to get something > >> >running: I spent a number of hours a while back trying to teach > >> > >> And without having to buy into a language religion. > > > >Hm. I wouldn't say that adapting to local customs constitutes > >buying into a language religion. YMMV, I suppose. > > Some of the posters have been quite vociferous about it. I've noticed a certain amount of, oh, "contentiousness" maybe, on both sides. Sort of a :-), sort of not. (Aside: I recognize your name from alt.folklore.computers, where you seem, oh, much more mild-mannered. Hm.) > >> >myself some Scheme and in the process trying make it conform to > >> >my strongly-typed-languages-trained mindset, and I'd probably > >> >have done better to get a good introductory book and try to grok > >> >the no-types(?) mindset. (Maybe I'll try again at some point.) > > I am pretty much past the intro stage and into the pain stage > where there is not so much help. That people are not willing to offer further help when many of their previous suggestions have been rejected should not be a total surprise. <shrug> -- B. L. Massingill ObDisclaimer: I don't speak for my employers; they return the favor.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-06-28 17:54 -0700
Re: StringBuilder Difficulties Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-28 21:29 -0400
Re: StringBuilder Difficulties Lew <noone@lewscanon.com> - 2011-06-29 00:48 -0400
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-06-29 12:19 -0700
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-06-29 12:11 -0700
Re: StringBuilder Difficulties Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-29 22:06 -0400
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-29 20:17 +0000
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-06-29 18:55 -0700
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-30 20:30 +0000
Re: StringBuilder Difficulties Patricia Shanahan <pats@acm.org> - 2011-06-30 14:17 -0700
Re: StringBuilder Difficulties Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-30 21:36 -0400
Re: StringBuilder Difficulties "John B. Matthews" <nospam@nospam.invalid> - 2011-07-01 01:41 -0400
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-06-30 14:26 -0700
Re: StringBuilder Difficulties Steve Sobol <sjsobol@JustThe.net> - 2011-06-30 17:33 -0700
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-01 20:47 +0000
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-07-01 17:29 -0700
Re: StringBuilder Difficulties rossum <rossum48@coldmail.com> - 2011-07-02 11:36 +0100
Re: StringBuilder Difficulties Robert Klemme <shortcutter@googlemail.com> - 2011-07-02 12:58 +0200
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-07-04 07:52 -0700
Re: StringBuilder Difficulties Robert Klemme <shortcutter@googlemail.com> - 2011-07-04 21:45 +0200
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-05 02:06 -0400
Re: StringBuilder Difficulties markspace <-@.> - 2011-07-05 09:32 -0700
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-05 14:13 -0400
Re: StringBuilder Difficulties markspace <-@.> - 2011-07-05 12:51 -0700
Re: StringBuilder Difficulties Silvio <silvio@moc.com> - 2011-07-05 23:16 +0200
Re: StringBuilder Difficulties markspace <-@.> - 2011-07-05 15:08 -0700
Re: StringBuilder Difficulties Silvio <silvio@moc.com> - 2011-07-06 09:41 +0200
Re: StringBuilder Difficulties "eye" <eye@mocka.com> - 2011-07-06 09:55 +0000
Re: StringBuilder Difficulties thoolen <thoolen@tholenbot.thorium> - 2011-07-06 05:37 -0400
Re: StringBuilder Difficulties "thoolen" <thoolen@tholenbot.thorium> - 2011-07-06 08:43 -0400
Re: StringBuilder Difficulties thoolen <thoolen@tholenbot.thorium> - 2011-07-06 22:30 -0400
Re: StringBuilder Difficulties "Stefan Robacki" <noemail@noemail.foobar> - 2011-07-06 00:04 -0400
Re: StringBuilder Difficulties thoolen <thoolen@tholenbot.thorium> - 2011-07-06 05:45 -0400
Re: StringBuilder Difficulties thoolen <thoolen@tholenbot.thorium> - 2011-07-06 08:26 -0400
Re: StringBuilder Difficulties thoolen <thoolen@tholenbot.thorium> - 2011-07-06 22:36 -0400
Re: StringBuilder Difficulties "tholen@antispam.ham" <tholen@ifa.hawaii.edu> - 2011-07-06 06:09 -0700
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 22:40 -0400
Re: StringBuilder Difficulties John Doe <jdoe@usenetlove.invalid> - 2011-07-14 06:50 +0000
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-14 02:58 -0400
Re: StringBuilder Difficulties Jane Doe <jdoe@love.in.d.jungle.invalid> - 2011-07-14 10:20 -0400
Re: StringBuilder Difficulties thoolen <tholen01@gmail.com> - 2011-07-14 07:33 -0700
Re: StringBuilder Difficulties Stanimir Stamenkov <s7an10@netscape.net> - 2011-07-05 23:44 +0300
Re: StringBuilder Difficulties markspace <-@.> - 2011-07-05 14:08 -0700
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-02 18:33 +0000
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-02 16:56 -0400
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-03 01:34 +0000
Re: StringBuilder Difficulties Patricia Shanahan <pats@acm.org> - 2011-07-02 19:55 -0700
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-04 03:32 +0000
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-07-04 08:04 -0700
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-05 19:12 +0000
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-07-05 14:06 -0700
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-05 21:16 +0000
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-07-05 17:29 -0700
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-06 16:59 +0000
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 19:52 -0400
Re: StringBuilder Difficulties Patricia Shanahan <pats@acm.org> - 2011-07-06 16:58 -0700
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 19:52 -0400
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 21:54 -0400
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 22:18 -0400
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 22:41 -0400
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-08 17:45 +0000
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 05:48 -0400
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-06 16:59 +0000
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-07-06 10:56 -0700
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-08 17:44 +0000
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-07-08 11:51 -0700
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-10 19:08 +0000
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-07-11 07:54 -0700
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-11 22:37 +0000
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-07-11 15:52 -0700
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 08:25 -0400
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 19:41 -0400
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 19:58 -0400
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 21:57 -0400
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 22:17 -0400
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 22:44 -0400
Re: StringBuilder Difficulties Steve Erwin <trollHunter@Usenet.4.usenetizens.org.invalid> - 2011-07-07 12:51 +1000
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 23:02 -0400
Re: StringBuilder Difficulties John Doe <jdoe@usenetlove.invalid> - 2011-07-14 06:32 +0000
Re: StringBuilder Difficulties supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-14 02:57 -0400
Re: StringBuilder Difficulties Jane Doe <jdoe@love.in.d.jungle.invalid> - 2011-07-14 10:07 -0400
Re: StringBuilder Difficulties thoolen <tholen01@gmail.com> - 2011-07-14 07:24 -0700
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-07-04 07:58 -0700
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-05 19:09 +0000
Re: StringBuilder Difficulties KitKat <kitkat_11697@gmail.example.com> - 2011-07-05 15:15 -0400
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-05 20:03 +0000
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-07-05 14:11 -0700
Re: StringBuilder Difficulties blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-06 16:55 +0000
Re: StringBuilder Difficulties lewbloch <lewbloch@gmail.com> - 2011-07-03 00:08 -0700
Re: StringBuilder Difficulties Robert Klemme <shortcutter@googlemail.com> - 2011-07-03 12:35 +0200
Re: StringBuilder Difficulties lewbloch <lewbloch@gmail.com> - 2011-07-04 04:07 -0700
Re: StringBuilder Difficulties Patricia Shanahan <pats@acm.org> - 2011-06-29 14:38 -0700
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-06-29 15:00 -0700
Re: StringBuilder Difficulties Patricia Shanahan <pats@acm.org> - 2011-06-29 15:52 -0700
Re: StringBuilder Difficulties Gene Wirchenko <genew@ocis.net> - 2011-06-29 18:58 -0700
Re: StringBuilder Difficulties Patricia Shanahan <pats@acm.org> - 2011-06-29 19:26 -0700
Re: StringBuilder Difficulties lewbloch <lewbloch@gmail.com> - 2011-07-03 00:11 -0700
Re: StringBuilder Difficulties Roedy Green <see_website@mindprod.com.invalid> - 2011-06-29 18:32 -0700
csiph-web