• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Most efficient character parsing.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Most efficient character parsing.


  • Subject: Re: Most efficient character parsing.
  • From: Jean-François Veillette <email@hidden>
  • Date: Mon, 20 Feb 2006 13:58:25 -0500

Oh, while you're at it, you could pre-init your stringbuffer with the
length of your result string, so it doesn't get re-allocated every
few calls, pull up the chararray[i] into a variable and also with an
explicit if(c == \n...) check.

Both of these are very good points. They should speed up the boolean array solution even more. Not sure what the "if(c == \n...)" is in reference to.

"\n". Use an explicit character comparison.

It will not help for character parsing, but if you want to compare string identity (==), then you should use intern().
This can be useful when comparing string for equality with a constant string.
as in : if(aStringFromAnArgument.intern() == A_StringConstant) ...


from the javadoc ...

public String intern()
Returns a canonical representation for the string object.

A pool of strings, initially empty, is maintained privately by the class String.

When the intern method is invoked, if the pool already contains a string equal to this String object as determined by the equals(Object) method, then the string from the pool is returned. Otherwise, this String object is added to the pool and a reference to this String object is returned.

It follows that for any two strings s and t, s.intern() == t.intern() is true if and only if s.equals(t) is true.

All literal strings and string-valued constant expressions are interned. String literals are defined in §3.10.5 of the Java Language Specification

Returns:
a string that has the same contents as this string, but is guaranteed to be from a pool of unique strings.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Most efficient character parsing. (From: "Eric Stewart" <email@hidden>)
 >Re: Most efficient character parsing. (From: Anjo Krank <email@hidden>)
 >Re: Most efficient character parsing. (From: "Eric Stewart" <email@hidden>)
 >Re: Most efficient character parsing. (From: Anjo Krank <email@hidden>)

  • Prev by Date: Re: Deleting Flattened Relationships
  • Next by Date: Re: PostgreSQL vs MySQL for Blobs
  • Previous by thread: Re: Most efficient character parsing.
  • Next by thread: Re: Most efficient character parsing.
  • Index(es):
    • Date
    • Thread