String interning (WAS: SAX2/Java: Towards a final form)
David Megginson
david at megginson.com
Tue Jan 18 20:17:51 GMT 2000
Tyler Baker <tyler at infinet.com> writes:
> As you can see an identity test is done right off the bat so if you make a call like this:
>
> if (foo.equals("x")) {
>
> }
>
> And foo == "x", then your only additional overhead to a straight identity test is the
> dynamic method invocation of String.equals().
Only if the strings are equal -- if you're in a long switch statement,
most of them won't be equal, and the overhead will be much more than
the function call.
All the best,
David
--
David Megginson david at megginson.com
http://www.megginson.com/
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ or CD-ROM/ISBN 981-02-3594-1
Please note: New list subscriptions now closed in preparation for transfer to OASIS.
More information about the Xml-dev
mailing list