[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Playing with guile (vs python). Generate file for GDP suitable for g

From: Germán Diago
Subject: Re: Playing with guile (vs python). Generate file for GDP suitable for gnuplot.
Date: Wed, 1 Feb 2017 10:56:59 +0700

> If I understand your script correctly, you want to grab all lines with
> GDP, sort the values by year and country and output them. Is that right?
> As a first warning: the csv module in Python mainly calls into a C-based
> implementation (_csv, see csv.__file__), so it will be hard to beat this
> in pure Scheme.
> Good to know.

> But now, let’s begin with the optimization. These are my times:
> $ time guile-2.0 extract_gdp.scm
> real    0m0.509s
> $ time python3
> real    0m0.089s
> The first step is using Guile 2.1.6 instead of 2.0. That reduces the
> runtime by 40% to 0.3s. Source:
> guile-2.1.6.tar.xz

> $ time guile extract_gdp.scm
> real    0m0.296s
> $ time python3
> real    0m0.089s
> So there’s a factor of 3.3 between Python and Guile on my machine.
> Aside from using a more recent Guile, I do not see obvious
> optimizations, however (more exactly: all my tries to speedup the code
> only made it slower).

I was struggling with using read-line! instead of read-line but
experimenting in the command line
I cannot figure out how it works actually. read-line! will reuse a buffered
string. There was lots of time spent there, I am not sure if because of
allocations or just because of I/O. If someone could tell me how to do it...

Thanks for your time Arne!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]