Print

Print


Hi,

On Mon, May 18, 2015 at 5:35 PM, Eric Lease Morgan <[log in to unmask]> wrote:
> I have two scripts, attached. They do EXACTLY the same thing
> in almost EXACTLY the same manner, but the Python script is
> almost 25 times slower than the Perl script:

I'm no Python expert, but I think that the difference is much more
likely due to which JSON processor is being used.  I suspect your Perl
environment has the JSON::XS module, which is written in C, is fast,
and is automatically invoked (if present) by "use JSON;".

In contrast, I believe that the Python "json" library is written in
Python itself.  I tried swapping in cjson and UltraJSON [1] in place
of "json" in your Python script, and in both cases it ran rather
faster.

[1] https://github.com/esnme/ultrajson

Regards,

Galen
-- 
Galen Charlton
Infrastructure and Added Services Manager
Equinox Software, Inc. / The Open Source Experts
email:  [log in to unmask]
direct: +1 770-709-5581
cell:   +1 404-984-4366
skype:  gmcharlt
web:    http://www.esilibrary.com/
Supporting Koha and Evergreen: http://koha-community.org &
http://evergreen-ils.org