Hacker News new | ask | show | jobs
by imaginenore 4394 days ago
0.1ms to parse a date???

Even the standard PHP string parser does 0.017ms on my 3 year old netbook.

    <?php

    $st = microtime(true);
    $cnt = 10000;

    for ($i=0; $i<$cnt; $i++)
    	strtotime('2014-01-09T21:48:00.921000');

    echo 1000 * (microtime(true) - $st) / $cnt;
Seems like this solves a non-existing issue.
2 comments

You can see the issue it solves pretty clearly here: https://github.com/elasticsales/ciso8601#benchmark

Python != PHP

Actually both Python and PHP are ridiculously slow languages. Though Python is slower.
Some implementations of python are slowish for some tasks. Many parts, like the module being discussed are written in C/assembly/fortran/Java.

Python with a jit is Pypy, http://speed.pypy.org/

Also PHP has some fast _implementations_ of PHP.

Languages aren't slow. Interpreters are.

As a human, I can think a lot faster in Python. So for me, it's a faster language.

This also doesn't do the same thing, since you're not constructing a DateTime object.