Re: json stream filter

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

 



Gruß, Markus

Am 23.06.2013 um 05:08 schrieb Larry Garfield <larry@xxxxxxxxxxxxxxxx>:

> On 06/20/2013 04:26 AM, Markus Staab wrote:
>> Hi!
>>
>> first post on the list, so please bare with me ;-)

Yes the usual typo ;)

>>
>> we are handling a lot of cache files in our apps and use json to persist
>> those contents on the filesystem, because it seems to be the fastest
>> possible way to read/write files with PHP.
>>
>> Since I discovered stream-filters, http://www.php.net/manual/en/filters.php,
>> we use those also for base64 encoding files before sending them over the
>> wire, which preserves a lot of memory and allows even bigger files.
>>
>> Would it make sense to also have a native stream filter for fileformats
>> like JSON, to get maximum performance for reading/writing those (and also
>> to be able to write big files)?
>>
>> Thanks,
>> Markus
>
> What would it do, exactly?  Stream filters still have to read/write a string, don't they?  Unless you're talking about reading directly into a nested array structure (what json_decode() does), I am not sure what the benefit is of what you're describing.  (And I'm not sure you could do that, although it would be neato if you could.)

I also thought that the types could be a problem. The writing
functions expect strings and all reading functions return strings.
When handling json values, most of the time we need to handle arrays or objects.
But nevertheless I want to open this discussion maybe some people chim
in and have great ideas how to solve it.

Maybe there are other ways how we could improve the json handling from
within php in a more native way.
The actual problem is handling json within streams, which cannot be
fast enough for todays applications.

I also played with the idea to use a generator-like approach to make
iterating a json-stream possible without the need to built the whole
object into memory at first.

Just some additional random thoughts, though.


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

-- 
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