Arc Forumnew | comments | leaders | submitlogin
4 points by Pauan 4236 days ago | link | parent

Well! I just learned something new! Racket's "procedure-rename" is ridiculously slow. In case you don't know what I'm talking about, it's just a function that lets you rename functions:

  (procedure-rename (lambda () 1) 'foo)
Anyways, here's the timing tests I did for Arc/Nu using "procedure-rename":

  > (+ 1 2)
  Arc/Nu   iter: 45,419,082   gc:   0   diff:  0.00%
  Arc 3.1  iter: 52,867,613   gc: 188   diff: 16.40%

  > (no ())
  Arc/Nu   iter: 26,594,507   gc:   0   diff:   0.00%
  Arc 3.1  iter: 54,532,505   gc: 152   diff: 105.05%
And here's the results when I removed "procedure-rename":

  > (+ 1 2)
  Arc/Nu   iter: 88,933,497   gc:   0   diff: 71.88%
  Arc 3.1  iter: 51,741,236   gc: 116   diff:  0.00%

  > (no ())
  Arc/Nu   iter: 78,026,418   gc:   0   diff: 37.11%
  Arc 3.1  iter: 56,909,869   gc: 156   diff:  0.00%
What a ginormous difference. Removing it doubled the speed of Arc/Nu! Given that the sole purpose of "procedure-rename" is to, well, rename functions, I wouldn't expect it to have such a huge runtime performance penalty, but apparently it does...


3 points by lark 4235 days ago | link

I sometimes wonder if garbage collection in dynamic languages is necessary.

-----

2 points by rocketnia 4235 days ago | link

Sounds like a good topic, and I'd be interested in hearing to hear your thoughts on this. I've been thinking about the same kind of thing, but I'm looking to use it in a weakly typed subset of a statically typed language. My motivation is mostly to see if we can make it convenient to externally manage the memory needs of otherwise encapsulated programs.

This is probably a discussion for another thread. ^_^;

-----

1 point by akkartik 4235 days ago | link

My arc variant uses ref-counting, for what it's worth: https://github.com/akkartik/wart/blob/adf058706b/010memory

-----

1 point by rocketnia 4236 days ago | link

I wonder if the compiler can't see through a 'procedure-rename call to realize it can still apply optimizations to the code. Like, maybe it can optimize ((lambda (x) ...) 2) but not ((procedure-rename (lambda (x) ...) 'foo) 2).

-----