<div dir="ltr">Forgive my Python-naïveté, but is Python perhaps constructing a lazy input stream and managing to return quickly by simply not parsing anything yet? Or are you able to actually run some function on the whole file, get a result, and still return nearly immediately while Racket takes something like a minute?<br>
</div><div class="gmail_extra"><br clear="all"><div>Carl Eastlund</div>
<br><br><div class="gmail_quote">On Mon, Jan 14, 2013 at 11:12 AM, J G Cho <span dir="ltr"><<a href="mailto:gcho@fundingmatters.com" target="_blank">gcho@fundingmatters.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear performance experts,<br>
<br>
With the news of math library in Racket and the goal of improving my<br>
data analysis skill, I have started going over the examples in book<br>
"Python for Data Anyalysis" by McKinney using both Python and Racket.<br>
Too early to tell which is preferable for me. But I do have one<br>
"problem" with Racket that I would like to resolve before going on<br>
further.<br>
<br>
Here is the detail.<br>
<br>
Python:<br>
<br>
First I load the data<br>
<br>
# It looks like this at the top level;<br>
# structured differently from the example in the book.<br>
data_set = {<br>
"meta": {},<br>
"data": []<br>
}<br>
<br>
import json<br>
<br>
# read in the json data downloaded from<br>
# <a href="https://explore.data.gov/Information-and-Communications/1-USA-gov-Short-Links/wzeq-n5pg" target="_blank">https://explore.data.gov/Information-and-Communications/1-USA-gov-Short-Links/wzeq-n5pg</a><br>
with open("usagov_bitly_data.json") as f:<br>
data_set = json.load( f )<br>
<br>
<br>
And then I go do the usual slice and dice....<br>
<br>
My work flow is to edit the file and either run it inside Sublime Text<br>
2 or ipython --pylab. (v 2.7 via EPD package running on Win 7 on<br>
fairly new and powerful Dell.) There is a brief pause before I see the<br>
output in the screen.<br>
<br>
<br>
<br>
I run the following in DrRacket (v5.3):<br>
<br>
#lang racket<br>
<br>
(require json)<br>
<br>
(define data-set<br>
(call-with-input-file "usagov_bitly_data.json"<br>
(lambda (in)<br>
(read-json in))))<br>
<br>
<br>
It takes sometime (more than a few sips of tea) where edit-run cycle<br>
is not workable.<br>
<br>
I initially thought maybe the json library was the cause and tried<br>
writing the parsed data out as .sexp and then reading that in. It did<br>
not resolve the speed issue for me. I now work with a smaller subset<br>
of data when I work with Racket.<br>
<br>
Any suggestions?<br>
<br>
jGc<br>
____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br>
</blockquote></div><br></div>