Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.lang.java.programmer > #5652
| From | Gene Wirchenko <genew@ocis.net> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Passing a Method Name to a Method, Redux |
| Date | 2011-06-24 11:50 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <dsm9071kpkj0s4uabgupfmg49evfmhvs6h@4ax.com> (permalink) |
| References | <fpg7079ca2dtgipdphr8rm234kgmkd1t3l@4ax.com> <iu0t8a$kqc$1@dont-email.me> |
On Thu, 23 Jun 2011 19:36:53 -0700, Joshua Cranmer
<Pidgeot18@verizon.invalid> wrote:
>On 6/23/2011 4:03 PM, Gene Wirchenko wrote:
>> Dear Java'ers:
>>
>> I have completed my benchmarking. The code is below. Note that
>> the difference in the bodies between ParseSequentialSearch(),
>> ParseBinarySearch(), and ParseTreesetSearch() is but one line. I
>> really would have preferred not having to duplicate the code.
>>
>> Oddly, the timings have a LOT of noise in them. In some runs, a
>> sequential search has out-performed a binary search. Occasionally, a
>> sequential search has beaten both a binary search and a Treeset
>> search. The times for sequential searching are only a bit worse than
>> for binary searching. Treeset searching is about 20% faster. Any
>> explanations?
>
>Here is probably the best implementation:
Nope. I want a configurable character set for identifiers
[snip]
>There are other performance improvements:
>1. Use StringBuilder. It's mutable, so it avoids copies (kind of like
>ArrayList). Heck, that's what your code is doing, it just keeps copying
>back and forth between strings.
Noted.
>2. It's probably better to throw out StringBuilder and use token extents
>(i.e., from index 5 to 9 is this identifier). It saves copying and can
>allow for better error messages in parsers by being able to pinpoint
>line/column numbers accurately.
I plan to for the real thing. I have other changes as well.
>But yeah, I would have coded my benchmark like that. Since you seem to
>be concerned with microoptimization here, anything which looks different
>from what the real parser implementation would show up as having impact
>in timing numbers.
Nah, I just do not have a sense of how fast various Java things
are. Benchmark to find out.
>Finally, I might add, if you're writing a full parser, it might be
>better to just use an existing Java lexer rather than rolling your own
>unless you have a *very* good reason not to.
I am writing a *simple* parser. It is not for grovelling over
Java code. It is for a preprocessor for SQL Server for better code
management. I mean for it to be fairly language-agnostic.
Sincerely,
Gene Wirchenko
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Passing a Method Name to a Method, Redux Gene Wirchenko <genew@ocis.net> - 2011-06-23 16:03 -0700
Re: Passing a Method Name to a Method, Redux Gene Wirchenko <genew@ocis.net> - 2011-06-23 16:26 -0700
Re: Passing a Method Name to a Method, Redux blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-27 21:41 +0000
Re: Passing a Method Name to a Method, Redux markspace <-@.> - 2011-06-23 17:24 -0700
Re: Passing a Method Name to a Method, Redux Gene Wirchenko <genew@ocis.net> - 2011-06-23 19:46 -0700
Re: Passing a Method Name to a Method, Redux blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-04 03:26 +0000
Re: Passing a Method Name to a Method, Redux lewbloch <lewbloch@gmail.com> - 2011-07-04 03:41 -0700
Re: Passing a Method Name to a Method, Redux blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-05 19:07 +0000
Re: Passing a Method Name to a Method, Redux markspace <-@.> - 2011-06-23 17:34 -0700
Re: Passing a Method Name to a Method, Redux Gene Wirchenko <genew@ocis.net> - 2011-06-23 19:42 -0700
Re: Passing a Method Name to a Method, Redux markspace <-@.> - 2011-06-23 18:30 -0700
Re: Passing a Method Name to a Method, Redux Gene Wirchenko <genew@ocis.net> - 2011-06-23 19:48 -0700
Re: Passing a Method Name to a Method, Redux markspace <-@.> - 2011-06-23 21:02 -0700
Re: Passing a Method Name to a Method, Redux lewbloch <lewbloch@gmail.com> - 2011-06-24 08:38 -0700
Re: Passing a Method Name to a Method, Redux markspace <-@.> - 2011-06-24 09:04 -0700
Re: Passing a Method Name to a Method, Redux Lew <noone@lewscanon.com> - 2011-06-26 13:43 -0400
Re: Passing a Method Name to a Method, Redux Lew <noone@lewscanon.com> - 2011-06-26 14:31 -0400
Re: Passing a Method Name to a Method, Redux Gene Wirchenko <genew@ocis.net> - 2011-06-24 11:45 -0700
Re: Passing a Method Name to a Method, Redux markspace <-@.> - 2011-06-24 12:19 -0700
Re: Passing a Method Name to a Method, Redux Gene Wirchenko <genew@ocis.net> - 2011-06-26 20:39 -0700
Re: Passing a Method Name to a Method, Redux markspace <-@.> - 2011-06-26 23:33 -0700
Re: Passing a Method Name to a Method, Redux Gene Wirchenko <genew@ocis.net> - 2011-06-27 13:53 -0700
Re: Passing a Method Name to a Method, Redux markspace <-@.> - 2011-06-27 18:03 -0700
Re: Passing a Method Name to a Method, Redux Gene Wirchenko <genew@ocis.net> - 2011-06-28 11:41 -0700
Re: Passing a Method Name to a Method, Redux blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-24 19:19 +0000
Re: Passing a Method Name to a Method, Redux Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-23 19:36 -0700
Re: Passing a Method Name to a Method, Redux Gene Wirchenko <genew@ocis.net> - 2011-06-24 11:50 -0700
Re: Passing a Method Name to a Method, Redux Jeff Higgins <jeff@invalid.invalid> - 2011-06-24 17:25 -0400
Re: Passing a Method Name to a Method, Redux Gene Wirchenko <genew@ocis.net> - 2011-06-26 20:42 -0700
Re: Passing a Method Name to a Method, Redux markspace <-@.> - 2011-06-26 23:27 -0700
Re: Passing a Method Name to a Method, Redux Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-27 03:04 -0400
Re: Passing a Method Name to a Method, Redux Gene Wirchenko <genew@ocis.net> - 2011-06-27 13:12 -0700
Re: Passing a Method Name to a Method, Redux Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-27 13:36 -0700
Re: Passing a Method Name to a Method, Redux Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-24 15:50 -0700
csiph-web