in reply to Re: Re: Fast search/replace?
in thread Fast search/replace?

Constructing an image with list values representing individual pixels is a bit like making a cake by assembling crumbs.

Even a 1-dimensional array will not provide any acceptable level of performance for this task. There's just alot of overhead involved in processing list values, as compared with a raw buffer.

If none of the suggested image modules do what you are looking for, I would first recommend that you store and modify your image in place, as a raw scalar stream of bytes. If you're simply trying to swap byte A with byte B, applying the tr/// operator will probably suffice, as it uses an efficient table-lookup technique. If you need to swap 16-bit or larger words, the s/// operator may also offer an acceptable level of performance, but won't come close to what you could do with optimized assembler or C code.

Manipulating raw buffers in an efficient manner is not one of Perl's strengths :|

   MeowChow                                   
               s aamecha.s a..a\u$&owag.print