Arc Forumnew | comments | leaders | submitlogin
2 points by Pauan 4754 days ago | link | parent

I figured out why `(+ 1 2)` is so slow in Nu. It was calling Arc's `or` which is pretty slow (compared to not calling it, anyways). So here's the new numbers, this time using the time library[1]:

  (timeit (+ 1 2))

  ar      time: 11.904  gc: 0.404  mem: -19311.072
  Nu      time:  9.282  gc: 0.0    mem:     88.416  (direct-calls #f)
  Arc 3.1 time:  7.86   gc: 0.39   mem:  -9687.53   (direct-calls #f)
  Nu      time:  5.282  gc: 0.0    mem:     88.8    (direct-calls #t)
  Arc 3.1 time:  1.55   gc: 0.0    mem:     89.95   (direct-calls #t)
As you can see, Nu is now faster than ar, but still slower than Arc 3.1. On the other hand, Nu's + is implemented in terms of case-lambda, so it should be better on memory in the case of only 2 arguments.

---

* [1]: https://github.com/Pauan/ar/blob/nu/lib/time.arc

---

Random side note: zip is awesome.