Hello there,
I am definitely sure that the Java compiler optimizes string concatenation. For the same task I do need 3 seconds in (NetRexx ) and Java, and more than 150 in Object Rexx. Simple benchmark results from my Rexx2Nrx work (bootstrapping my Rexx Compiler) hope this helps, Tom, (and cheers from dark Vienna) > -----Ursprüngliche Nachricht----- > Von: Patric Bechtel [SMTP:[hidden email]] > Gesendet am: Donnerstag, 6. Februar 2003 19:32 > An: Mike Cowlishaw > Cc: [hidden email] > Betreff: Re: Problem with nrc 2.02 > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Thu, 6 Feb 2003 08:42:32 +0000, Mike Cowlishaw wrote: > > Hello Mike, > > >> options binary strictcase strictargs > >> [...] > >> outWriter=FileWriter(outfile) > >> s=String > >> [...] > >> s='test;'id';'name';'count';'CRLF > >> outWriter.write(char[] s.toCharArray()) > > >The 'write' problem is almost unique in the Java libraries; I think you > >should be able to achieve what you want by using: > > > outWriter.write(String s) > > >though I would have expected the code you show to work. > > I tried that already. The first version of the code used all variations > of "guessing" NetRexx to use the String version of write, so: > > s=String "whatsoever" > outWriter.write(s) > > or even > > outWriter.write(String s) > > didn't work. I only thought it would NOT work around an array, so I > tried the char[] variant, but no go. > > >On concatenation; I believe the Javac compiler will use the StringBuffer > >class for concatenating strings -- check the bytecode listing. Also, > you > >can avoid the NetRexx calls there if you make CRLF type String. > > phew. I'm really not sure. But even then, the annoyance of getting an NPE > on concating a null String stays... > > tia > > Patric > > > PGP Public Key Fingerprint: 2636 F26E F523 7D62 4377 D206 7C68 06BB > > -----BEGIN PGP SIGNATURE----- > Version: PGPsdk version 1.7.1 (C) 1997-1999 Network Associates, Inc. and > its affiliated companies. > > iQA+AwUBPkKcK3xoBrvMu8qQEQKygQCgrgdZVfVDCING5HihZK2i5JnNP/MAl393 > pdbvw4c//LvIeI+n4wq39b8= > =8GvR > -----END PGP SIGNATURE----- > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~ > To unsubscribe from this mailing list ( ibm-netrexx ), please send a note > to > [hidden email] > with the following message in the body of the note > unsubscribe ibm-netrexx <e-mail address> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 On Thu, 6 Feb 2003 21:07:25 +0100, [hidden email] wrote: Hallo Thomas, hello Mike, I've just threw a closer look at the String concatenating issue (bytecode wise): e.g. this java code: a="hallo"+i+"noch"+i+"mal"; translates to: 10 new #5 <Class java.lang.StringBuffer> 13 dup 14 invokespecial #6 <Method java.lang.StringBuffer()> 17 ldc #7 <String "hallo"> 19 invokevirtual #8 <Method java.lang.StringBuffer append(java.lang.String)> 22 iload_2 23 invokevirtual #9 <Method java.lang.StringBuffer append(int)> 26 ldc #10 <String "noch"> 28 invokevirtual #8 <Method java.lang.StringBuffer append(java.lang.String)> 31 iload_2 32 invokevirtual #9 <Method java.lang.StringBuffer append(int)> 35 ldc #11 <String "mal"> 37 invokevirtual #8 <Method java.lang.StringBuffer append(java.lang.String)> 40 invokevirtual #12 <Method java.lang.String toString()> 43 astore_1 So my fears are, at least for the jdk1.4.1_01 compiler, away. tia Patric >Hello there, > I am definitely sure that the Java compiler optimizes string >concatenation. > For the same task I do need 3 seconds in (NetRexx ) and Java, and more >than 150 in Object Rexx. > Simple benchmark results from my Rexx2Nrx work (bootstrapping my Rexx >Compiler) >hope this helps, >Tom, (and cheers from dark Vienna) > >> -----Ursprüngliche Nachricht----- >> Von: Patric Bechtel [SMTP:[hidden email]] >> Gesendet am: Donnerstag, 6. Februar 2003 19:32 >> An: Mike Cowlishaw >> Cc: [hidden email] >> Betreff: Re: Problem with nrc 2.02 >> >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> On Thu, 6 Feb 2003 08:42:32 +0000, Mike Cowlishaw wrote: >> >> Hello Mike, >> >> >> options binary strictcase strictargs >> >> [...] >> >> outWriter=FileWriter(outfile) >> >> s=String >> >> [...] >> >> s='test;'id';'name';'count';'CRLF >> >> outWriter.write(char[] s.toCharArray()) >> >> >The 'write' problem is almost unique in the Java libraries; I think you >> >should be able to achieve what you want by using: >> >> > outWriter.write(String s) >> >> >though I would have expected the code you show to work. >> >> I tried that already. The first version of the code used all variations >> of "guessing" NetRexx to use the String version of write, so: >> >> s=String "whatsoever" >> outWriter.write(s) >> >> or even >> >> outWriter.write(String s) >> >> didn't work. I only thought it would NOT work around an array, so I >> tried the char[] variant, but no go. >> >> >On concatenation; I believe the Javac compiler will use the StringBuffer >> >class for concatenating strings -- check the bytecode listing. Also, >> you >> >can avoid the NetRexx calls there if you make CRLF type String. >> >> phew. I'm really not sure. But even then, the annoyance of getting an NPE >> on concating a null String stays... >> >> tia >> >> Patric >> >> >> PGP Public Key Fingerprint: 2636 F26E F523 7D62 4377 D206 7C68 06BB >> >> -----BEGIN PGP SIGNATURE----- >> Version: PGPsdk version 1.7.1 (C) 1997-1999 Network Associates, Inc. and >> its affiliated companies. >> >> iQA+AwUBPkKcK3xoBrvMu8qQEQKygQCgrgdZVfVDCING5HihZK2i5JnNP/MAl393 >> pdbvw4c//LvIeI+n4wq39b8= >> =8GvR >> -----END PGP SIGNATURE----- >> >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> ~~~ >> To unsubscribe from this mailing list ( ibm-netrexx ), please send a note >> to >> [hidden email] >> with the following message in the body of the note >> unsubscribe ibm-netrexx <e-mail address> >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to >[hidden email] >with the following message in the body of the note >unsubscribe ibm-netrexx <e-mail address> PGP Public Key Fingerprint: 2636 F26E F523 7D62 4377 D206 7C68 06BB -----BEGIN PGP SIGNATURE----- Version: PGPsdk version 1.7.1 (C) 1997-1999 Network Associates, Inc. and its affiliated companies. iQA/AwUBPkK58nxoBrvMu8qQEQJMHQCggfBXLYq2KLWG0NRukOGZ6Or97O0AoP6z /+dImOOqj3aSGwcSsNsFYndu =vvDM -----END PGP SIGNATURE----- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to [hidden email] with the following message in the body of the note unsubscribe ibm-netrexx <e-mail address> |
Free forum by Nabble | Edit this page |