(I received an email from mailer-dae...@lists.php.net ,  I had to cut the
message history as the mail server complained because the email got too
long)

Larry, here is the same benchmark including memory_get_peak_usage as
requested (more after the benchmark)

----- Benchmark including memory_get_peak_usage -----

# json_decode()

Megas used before call: 79.23828125
PEAK Megas used before call: 128.00390625 //<----
Megas used after call: 3269.23828125
PEAK Megas used after call: 3309.23828125 //<----
Difference: 3190
PEAK Difference: 3181.234375 //<-----
Time: 12.109144926071 seconds

# is_json()

Megas used before call: 79.23828125
PEAK Megas used before call: 128.00390625 //<----
Megas used after call: 79.23828125
PEAK Megas used after call: 128.00390625 //<----
Difference: 0
PEAK Difference: 0 //<-----
Time: 5.4504480361938 seconds


I want to clarify, as I previously mentioned, I did not develop any parser
at all, the parser already exists in PHP and is use by json_decode(), in
short words , what I propose is to create a new function, as an interface
to THE EXISTING PARSER, only, and only, to check if  a string is a valid
json-string or not.

I already provided a lot, but a lot of real usages of this, and at the
moment the only way to do it (without using any 3rd package) is by using
json_decode() , and the drawback is that json_decode() generates an
object/array while parsing the string provided affecting the memory
associated with the php process; and sometimes you just need to check if an
string is valid json-string or not and nothing else; I have provided code
from major open-source projects, and also THE question in stack overflow,
which is viewed near 500k times, which indicates somehow the number of
users interested in something like this.

And yes, we can use a 3rd party package, but in companies, using a 3rd
party package is not that simple, believe me.

------------

Regarding publishing the a PR with my implementation, is out of context at
the moment, because we are discussing if a functionality like this should
be included or not, and nothing else. Also I am pretty sure that if this
gets a YES from the community (so far seems so), and I show my
implementation, someone will tell me that it could be done in a different
way , and is totally fine, is great actually. But now, at this moment,
everything is about the functionality.

-------------

I also want you to know that I really, really appreciate the time you took
to participate on this and being direct and honest ..... THANKS A LOT (I
really mean it).


==============

People I have made my best effort providing you all with as much
information and answers as possible.

At the end is up to the community, if YES ... great , if NO ... great
anyway, it has being a beautiful trip so far, but I cannot lie to you, I
would really like to see whats next.


I send you all my best wishes.

Juan

>

Reply via email to