Arc Forumnew | comments | leaders | submitlogin
4 points by rntz 5365 days ago | link | parent

I'd be interested to see an actual comparison of the time it takes to parse some example files with the two different versions of 'whitespace?. Why use microbenchmarks when you can test on real-world examples?

> One difference: 'faster-in returns the found value, rather than 't.

What if that value is nil? That makes for a nasty corner case.



2 points by conanite 5363 days ago | link

a faster 'in, without the nasty corner case:

  (mac faster-in (x . choices)
    (w/uniq g
      `(let ,g ,x
         (if ,@(mappend (fn (c) `((is ,g ,c) t)) choices)))))
it's a tiny difference, and if you know in advance you're not looking for nil, the other version is just as good.

-----

1 point by conanite 5364 days ago | link

What if that value is nil? That makes for a nasty corner case.

oops, yes, you're right, good point

Why use microbenchmarks

using parser.arc to index tokens from arc.arc is the benchmark I use most often for tuning rainbow performance. I wanted to present the issue with as few extraneous details as possible.

-----

2 points by tc-rucho 5362 days ago | link

Micro benchmarks can be misleading sometimes. Most of the time I get different timings for the same microbenchmark when I eval it a few times so it's really difficult to see if they really do their job when the timings are too close unless some full blown benchmark is performed on some real data.

-----