This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: kawa-java string compatibility proposal


Vadim Nasardinov wrote:
StringBuffer is significantly faster than char[] in many cases.
Converting a char[] instance to a String via new String(char[]) always
involves copying.
Converting a StringBuffer to String via StringBuffer#toString()
involves no copying, provided the StringBuffer instance is never
mutated after you call toString() on it.

True. On the other hand, StringBuffer has extra non-trivial overhead, including synchronization. Using StringBuilder reduces the overhead, but doesn't remove it, and is Java5-specific. And char[] does have semantics closer to Scheme strings.

Off-topic: Fixed-lengh mutable strings are really a useless data-type,
except as a building-block to implement more useful data structures.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]