[racket] Performance help

From: Gustavo Massaccesi (gustavo at oma.org.ar)
Date: Thu Jan 15 10:05:25 EST 2015

I just submitted new PR: https://github.com/jmoy/norvig-spell/pull/4

I moved `(in-value (substring rht 1))` so it's calculated only once.
This change reduces the time in my machine from 14,4s to 13,3s.

The new implementation has too many `in-value`. I was wondering if it
would be a good idea to have a alternative `for` family variant that
assumes that every clause has a `in-value` unless it has a explicit
`in-sequence` or `in-_something_`.

I still think that the use of `(string (string-ref r ?))` are very
inefficient, because they create strings that are almost immediately
discarded. But all the alternatives I tried are slower. It's strange
that `(substring r 1 2)` is slower than `(string (string-ref r 1))`.

Gustavo


On Sun, Jan 11, 2015 at 12:04 PM, Jyotirmoy Bhattacharya
<jyotirmoy at jyotirmoy.net> wrote:
> I have now tested using v 6.1.1 and the time does drop to 17s from the
> earlier 24s though this still remains higher than Python's 13s.
>
> I have updated the GitHub README with the new numbers.
>
> Jyotirmoy
>
> On Mon, Jan 5, 2015 at 6:59 AM, Jyotirmoy Bhattacharya
> <jyotirmoy at jyotirmoy.net> wrote:
>>
>> > On Jan 5, 2015 4:14 AM, "Matthew Flatt" <mflatt at cs.utah.edu> wrote:
>> > >
>> > > At Sun, 4 Jan 2015 20:18:11 +0100, Jens Axel Søgaard wrote:
>> > > > One possibility: Python hash tables are fast(er).
>> > >
>> > > That reminds me: I sped up `equal?` hash tables on strings in v6.1.1.
>> > >
>> > > If Jyotirmoy is using version v6.1 instead of v6.1.1, that could
>> > > explain the time differences that he sees versus Greg's times. On my
>> > > machine, I get 9.4s for v6.1.1 versus 13.5s for v6.1.
>> > >
>> > >
>> > I am using v6.1. Will try to set up v6.1.1 and measure the timing.
>> >
>> > Jyotirmoy
>
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>


Posted on the users mailing list.