Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

speeding up JSON parsing in Perl

I've been using the JSON package in a perl script that parses a long list of relatively short JSON strings and I profiled the process with Devel::NYTProf. It seems like most of the time is taken by the JSON string function in the parsing process.

Are there any speed-ups that I could use other than not using the JSON package and try to speed it up by parsing it myself?

EDIT: The JSON package was installed in the system using cpanm. If there are any speed-ups to be gained by optimizing the installation process, they are also welcomed.

like image 272
719016 Avatar asked Jul 10 '13 12:07

719016


1 Answers

Try to install JSON::XS. Then, "use JSON" automatically uses the XS version. This module was written in C, and it has a very good performance.

like image 62
Miguel Prz Avatar answered Sep 21 '22 03:09

Miguel Prz