Re: Better way to store data in memory?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2007-07-23 at 17:50 +0100, Richard Davey wrote:
> Hi php-general collective,
> 
> I'm building up some image data in my PHP script (ready for output to
> the browser). Having to do some complex per pixel manipulation, which
> is fine - but I'm just wondering is there a quicker / more efficient
> way of storing the pixel data than in an array?

What kind of data? Can't you just store it in the image? Or a working
copy of the image?

> At the moment I hold it in $array[$x][$y], which makes the drawing
> loop painless, but it's creating an array with 307,200 elements which

Is it possible for you to just store the entires you use? or are you
actually storing data for 307,200 elements?

> is proving to be quite slow. As I'm only storing fixed width byte
> values is there an alternative method? For example the ability to
> read/write to a chunk of memory instead? (so I can read out whole
> strips of data rather than one by one?)

Sure, store it in a string and treat the string as a binary chunk.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux