On Thursday, November 19, 2015 at 11:18:16 PM UTC-5, Brian Adkins wrote:
> On Thursday, November 19, 2015 at 11:08:07 PM UTC-5, Brian Adkins wrote:
> > On Thursday, November 19, 2015 at 9:56:01 PM UTC-5, gustavo wrote:
> > > > I did *some* hand optimizing. Here's the code for the soundex and some 
> > > > string helper functions I created:
> > > >
> > > > https://gist.github.com/lojic/1deba97f2e2eb2fe3fc0
> > > >
> > > 
> > > I'm optimistic and I think that there is still some room for
> > > micro-optimizations (for example, replace the set!'s, but I didn't try
> > > yet).
> > 
> > I think the set!'s are what make it faster. Folks proposed various for 
> > statements which were much more elegant, but they were slower. I usually 
> > favor elegance over speed, and for the vast majority of my code, 
> > elegance/readability/etc. are more important, but this code takes hours to 
> > run, so speeding it up is helpful.
> > 
> > > But more important is:Do you want to preserve the general structure of 
> > > the code?
> > > 
> > > It has many small functions that are nice to write and debug, but each
> > > one creates an intermediate string. In this algorithm, most of the
> > > processing is character-by-character. So I think that most of the
> > > calculations can be merged in a megafunction that avoids most of the
> > > allocations.
> > 
> > Possibly, but profiling showed that various string functions were on the 
> > critical path.
> > 
> > > 
> > > Gustavo
> 
> FWIW here's some profile output:
> 
> https://gist.github.com/lojic/f1ea6371155db861e2cd
> 
> and the output from time on one run showing gc time
> 
> cpu time: 2908 real time: 2915 gc time: 84

And for completeness, I added the parser.rkt file to the gist, so all 3 files 
are there now:

https://gist.github.com/lojic/1deba97f2e2eb2fe3fc0

I think I'll code up a multi-threaded Rust or C version and see how the numbers 
compare, and then the Racket version with places.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to