Arc Forumnew | comments | leaders | submitlogin
1 point by Pauan 4782 days ago | link | parent

Okay, we need to get it together, guys. Arc 3.1 is kicking our butts:

  (time (repeat 1000000 (+ 1 2)))

  Nu time:      1523 msec.
  ar time:      1173 msec.
  Arc 3.1 time:  745 msec. (direct-calls #f)
  Arc 3.1 time:  155 msec. (direct-calls #t)
What's strange is that I even optimized this so that Nu outputs the exact same code as Arc 3.1. Makes me wonder where the bottleneck is.


2 points by Pauan 4781 days ago | link

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.

-----

2 points by akkartik 4782 days ago | link

If it's any consolation:

  wart> time:repeat 1000 (+ 1 2)
  16050000/1000000
That's 16s for a thousandth of the work.

edit: the consing in wart is seriously out of control. This:

  repeat 1
    (+ 1 2)
conses 12330 new cells.

(There's no leak, so they're all freed by the end.)

-----