[racket] How can I speed up this code?

From: Ray Racine (ray.racine at gmail.com)
Date: Mon Jan 14 12:34:33 EST 2013

Was checking to see if Python "optimized" with a native 'C' parser.  This
seems to imply it does at least in 2.6. I have 2.7.3 in my system.

http://svn.python.org/view/python/trunk/Modules/_json.c?view=markup


On Mon, Jan 14, 2013 at 11:12 AM, J G Cho <gcho at fundingmatters.com> wrote:

> Dear performance experts,
>
> With the news of math library in Racket and the goal of improving my
> data analysis skill, I have started going over the examples in book
> "Python for Data Anyalysis" by McKinney using both Python and Racket.
> Too early to tell which is preferable for me. But I do have one
> "problem" with Racket that I would like to resolve before going on
> further.
>
> Here is the detail.
>
> Python:
>
> First I load the data
>
> # It looks like this at the top level;
> # structured differently from the example in the book.
> data_set = {
> "meta": {},
> "data": []
> }
>
> import json
>
> # read in the json data downloaded from
> #
> https://explore.data.gov/Information-and-Communications/1-USA-gov-Short-Links/wzeq-n5pg
> with open("usagov_bitly_data.json") as f:
>     data_set = json.load( f )
>
>
> And then I go do the usual slice and dice....
>
> My work flow is to edit the file and either run it inside Sublime Text
> 2 or ipython --pylab. (v 2.7 via EPD package running on Win 7 on
> fairly new and powerful Dell.) There is a brief pause before I see the
> output in the screen.
>
>
>
> I run the following in DrRacket (v5.3):
>
> #lang racket
>
> (require json)
>
> (define data-set
>   (call-with-input-file "usagov_bitly_data.json"
>     (lambda (in)
>       (read-json in))))
>
>
> It takes sometime (more than a few sips of tea) where edit-run cycle
> is not workable.
>
> I initially thought maybe the json library was the cause and tried
> writing the parsed data out as .sexp and then reading that in. It did
> not resolve the speed issue for me. I now work with a smaller subset
> of data when I work with Racket.
>
> Any suggestions?
>
> jGc
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130114/9c3d7ea1/attachment.html>

Posted on the users mailing list.