Groups | Search | Server Info | Login | Register


Groups > comp.lang.java.programmer > #5626

Re: Passing a Method Name to a Method, Redux

From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: Passing a Method Name to a Method, Redux
Date 2011-06-23 21:02 -0700
Organization A noiseless patient Spider
Message-ID <iu129n$d0q$1@dont-email.me> (permalink)
References <fpg7079ca2dtgipdphr8rm234kgmkd1t3l@4ax.com> <iu0pbg$26n$1@dont-email.me> <1lu707p0cpr9vhrpv51d7hmst6bt1qdbcv@4ax.com>

Show all headers | View raw


On 6/23/2011 7:48 PM, Gene Wirchenko wrote:
> On Thu, 23 Jun 2011 18:30:21 -0700, markspace<-@.>  wrote:
>
>> Some other things I'd do:
>
>> 1. Make life easier on the Mark I eyeball and print out your timing in
>> seconds:
>>
>>       System.out.println( " Duration=" + (Duration/1e9) );
>
>       Yes, if this were not just test code.

Test code is probably more important to get right than the actual 
production code.  You'll be using the test code more than the production. ;)

I have another question.  This code here, most of this is debugging? 
And you take the entire string and concatenate the characters together, 
but you don't actually parse this into tokens:


         while( xScan < cParseString.length() ) {
             char CurrChar = cParseString.charAt( xScan );
             fInIdentChars = SequentialSearch( CurrChar );
             if( TreesetSearch( CurrChar ) ) // different code
             {
                 if( fBuildingIdent ) {
                     cIdent += CurrChar;
                 } else {
                     fBuildingIdent = true;
                     cIdent = "" + CurrChar;
                 }
             } else if( fBuildingIdent ) {
                 fBuildingIdent = false;
                 if( nRepetitions == 1 ) {
                     System.out.println( cIdent );
                 }
             } else {
             }
             xScan++;
         }

Your just double checking that SequentialSearch and TreesetSearch return 
the same thing?  And you concat the whole cParseString into cIdent, you 
don't look for white space or anything and break cParseString into tokens?

Don't worry about Hash Test, I have something faster now.

BTW I refactored your test that you were copy-and-pasting around into 
one method.  Using techniques I mentioned in my first post to you on 
this subject.

     private static void time( TestCase r ) {
         long StartTime = System.nanoTime();
         for( int i = 1; i <= nRepetitions; i++ ) {
            r.parse();
         }
         long EndTime = System.nanoTime();
         long Duration = EndTime - StartTime;
         System.out.println( " Duration=" + (Duration/1e9) );
     }


Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

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