цитирам Ian Phillipps <[EMAIL PROTECTED]>: > On Tue, 19 Nov 2002 at 11:30:17 +0200, Vladi Belperchinov-Shabanski > wrote: > > > > hi! > > > > I hope I understand the problem correctly, i.e. `how to escape'? > > > > In this case I always prefer: > > > > our %ESCMAP = (); > > for ( 0 .. 255 ) { $ESCMAP{ chr( $_ ) } = sprintf("%%%02X", $_); } > > That's not enough fun: > > our %ESCMAP = map { chr($_) => sprintf "%%%02X",$_ } 0..255; > > :-)
define 'fun' please :))) > > > I did few benchmarks. The results were: > > (for 1_000_000 iterations over ~20 char string) > > Hmm.. this will depend heavily on the number of escapees in the string. > If you're expecting hardly any, then the best algorithm may be > different > dealing with running text in non-Latin script, where every char will > match. > > Every now and then, I get this sneaking feeling that I ought to write a > generalised "pack" that can do this sort of thing. But usually the > feeling passes. > > Ian > there are no fair benchmark :) anyway I think my benchmark is correct as long as I set all the functions (being tested) in the same situations (same input, same iterations count and expecting same correct result) finally I cannot benchmark the world (i.e. everything) ;) P! Vladi. -- Vladi Belperchinov-Shabanski <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> http://www.biscom.net/~cade http://cade.webbg.com ____________________________________________________ Какво е реклама в Интернет? - http://reklama.mail.bg