Can you make Amotoen faster?

148 views
Skip to first unread message

Richard Lyman

unread,
Jul 18, 2012, 10:12:37 PM7/18/12
to clo...@googlegroups.com
All,

There's not much code, and (sadly) not much documentation, but what's
there needs some performance love.

https://github.com/richard-lyman/amotoen

Notes:
- jvisualvm doesn't like me this week so help there might be enough
(I can't see anything other than clojure classes - I'd love to only
see my code)
- reifying IPosition to a faster implementation seems like it has potential
- I've used *warn-on-reflection* and fixed the single spot it mentioned
- I'm not convinced that the code used in 'either' is the best, and
I'm a bit confused about why it's better than the two other
commented-out forms
- Switching IPosition grammar-grammar away from a character-based
approach is an option, just one I'd like to avoid

It's a leiningen project, with 'lein test' being what I run to check
performance. The grammar parses itself 40 times and prints out how
long that took. The self-check method might be a good place to start
if walking through the code. Ignore the grammar samples, they haven't
been updated in a while. Basically the two 'core' files, under src and
test are all I'm working with right now.

Is it already as 'fast' as it can be??

-Rich

David Nolen

unread,
Jul 19, 2012, 9:09:37 AM7/19/12
to clo...@googlegroups.com
On Wed, Jul 18, 2012 at 10:12 PM, Richard Lyman <richar...@gmail.com> wrote:
> All,
>
> There's not much code, and (sadly) not much documentation, but what's
> there needs some performance love.
>
> https://github.com/richard-lyman/amotoen
>
> Notes:
> - jvisualvm doesn't like me this week so help there might be enough
> (I can't see anything other than clojure classes - I'd love to only
> see my code)

Have you tried profiling with YourKit? They allow free usage for open
source projects.

David

Richard Lyman

unread,
Jul 19, 2012, 7:48:43 PM7/19/12
to clo...@googlegroups.com
I seem to remember looking into it at some point... I'll check it out again.

Thanks!
-Rich

Richard Lyman

unread,
Aug 3, 2012, 6:57:11 PM8/3/12
to clo...@googlegroups.com
On Thu, Jul 19, 2012 at 7:09 AM, David Nolen <dnolen...@gmail.com> wrote:
YourKit was fantastic!! I especially loved the 'Hot Spots'
functionality--it led me right to the problems.

I've sped up Amotoen by several orders of magnitude on some of my
tests... I'm into the mid-twenty milliseconds on my self-check. It's
funny... I didn't believe it was that much faster - I had to step in
and verify that it was still creating the structures it needed to
instead of just bailing on an error or something.

Turns out that ref and dosync are *really* expensive. I always knew
there was a hit, but I never realized how much 'till now.

Thanks!
-Rich
Reply all
Reply to author
Forward
0 new messages