[REBOL] Re: On ordinal and cardinal numbers...
From: joel:neely:fedex at: 6-Jul-2001 6:50
Gabriele Santilli wrote:
> This seems to be 2.3 times slower than pick:
> ofs-pick: func [series offset] [pick skip series offset 1]
... Nice analysis! (Numbers are good!)
> If you put the code of the first ofs-pick inline, it is only
> 1.6 times slower ... provided the cases in which such code
> is needed are few, I think the overhead is not that great.
> Do you think this is worth adding new natives? (I'm
> really asking!)
I guess "worth" is in the mind of the beholder, but your
question inspires a few thoughts:
1) The issue of whether "the cases in which such code is
needed are few" is highly dependent on the application.
Programs that spend most of their time munching data that
has already been plucked from the tree (or other data
structure ;-) wouldn't suffer, but those that spend a
significant portion of their time navigating would
certainly be affected by a 60% increase in time required
for basic inner-loop operations.
2) Having to repeat
pick skip foo glarp 1
throughout the code sounds like a great opportunity for
typos and other such bugs to creep in.
3) Having to reproduce faithfully such expressions when parts
are actually replaced by various sub-expressions...
pick skip foo index? find quux breeble 1
pick skip baz 3 + length? substruct * 2 1
again sounds like lots of potential for obscurity and error.
I'm certainly enough of a realist to know that any enhancement
has to wait its turn in a prioritized list (with lots of high-
urgency competition for limited developer resources).
But I'm enough of an idealist to believe that we should be able
to discuss such things.
Thanks again for your thought -ful and -provoking comments!
There are two types of science: physics and stamp collecting!
-- Sir Arthur Eddington