Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: What language am I looking for?

From: lmecir:mbox:vol:cz at: 17-May-2001 20:32

Hi Joel,
> IMHO, block immutability has more to do with notational and > correctness issues ("principle of least surprise", avoidance > of subtle bugs, eliminating tricky cases that can "trip" the > interpreter, etc.) than performance. The performance issues > I *meant* to be describing require nothing more than block > construction and evaluation. Modifying or eliminating *these* > would have a *drastic* effect on REBOL notation. > > Consider the following fragment: > > >> showall: func [b [block!] /local c] > [ foreach item b > [ c: compose/deep [print [(mold :item) "=" (item)]] > [ do c > [ ] > [ ] > >> tot: 17 > == 17 > >> obj: instantiate [a: 1 b: 2 c: 3 d: 4 e: "done!"] > >> showall [tot obj/a obj/b obj/e] > tot = 17 > obj/a = 1 > obj/b = 2 > obj/e = done! > >> > > The value of C is not being mutated, but each pass through > the loop constructs a new block and then DOes that block. > Therefore, this bit of code would require recompilation of > C's (new) value on each pass. >
Well, the speed penalty for the above code seems to be obvious. But then, is this a "typical code sample"? I don't think so, and I want to speed up an average program. The cases like this can run as slow as interpreted and if you want to make them faster, you may try a faster rewrite to something more easily translatable.