r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3-OLD1]

Steeve
15-Jan-2009
[9662]
*pull is better
Graham
15-Jan-2009
[9663x2]
Brian, what's R3's memory footprint cf R2 ?
for similar applications?
Maxim
15-Jan-2009
[9665x2]
to-string does the same oas to-block.  even I have come to depend 
on the copying aspects of it, and I can assume that many others do 
to.
one question I have... does the object type also copy every series 
included like in R2 ?  that, IMHO one of the biggest regressions 
in rebol's history.   reversing the copy is impossible to do perfectly 
(scanning the new object, and attempting to link back the old series). 
plus it slows down rebol in a few ways.
BrianH
15-Jan-2009
[9667x2]
I'll check. It should just do a bind/copy, not a copy/deep.
MAKE object should just copy blocks, parens and functions - those 
are what can be bound. It shouldn't copy anything else.
Graham
15-Jan-2009
[9669x2]
Maxim, there is 'as-string ...
well, for R2
Steeve
15-Jan-2009
[9671]
...not working with anything else than binaries though...
BrianH
15-Jan-2009
[9672]
That is why I suggested AS and AS-* functions, Graham. The AS-* functions 
in R2 won't work in R3, but something non-aliasing would..
Steeve
15-Jan-2009
[9673x2]
Perhaps it's moment for Brian to add a page in the wiki...
to do the same work he did on parse evolution
BrianH
15-Jan-2009
[9675]
After some discussion in the appropriate area first. The wiki is 
for results of discussions, not the discussions themselves.
Steeve
15-Jan-2009
[9676x2]
do that then...
(it's not an order just a request)
[unknown: 5]
20-Jan-2009
[9678]
Any change to get a CONTINUE function in R3?
Henrik
20-Jan-2009
[9679]
>> continue
** Throw error: No loop to continue

This what you want?
[unknown: 5]
20-Jan-2009
[9680]
yeah is that in R3?
Henrik
20-Jan-2009
[9681]
yes, I have it in latest alpha here:

>> ? continue
USAGE:
        CONTINUE

DESCRIPTION:
        Throws control back to top of loop.
        CONTINUE is a native value.
[unknown: 5]
20-Jan-2009
[9682]
Excellent!  We needed that.
Henrik
20-Jan-2009
[9683]
goodie :-)
[unknown: 5]
20-Jan-2009
[9684x3]
You know what it does right?
It allows you to skip the rest of a while loop for example when the 
conditions are met.
This means far less evaluation is needed in your loops.
Sunanda
20-Jan-2009
[9687]
If you need to, you can fake it in r2 with loop 1 [...break ...]
R3 ---  for n 1 5 1 [print n continue print "not printed"]
R2 ---  for n 1 5 1 [loop 1 [print n  break print "not printed"]]
[unknown: 5]
20-Jan-2009
[9688x3]
A continue should skip the rest of a loop cycle and advance the loop 
to the next cycle based on the condition of the loop.  This means 
it is far more efficient than our current methods.
Break doesn't initiate the next cycle of the loop.
Yes Sundanda, your second method would do the trick but then your 
also introducing evaluation.  So you gotta be careful you not introducing 
more evaulation than your saving.
Sunanda
20-Jan-2009
[9691]
You may be disappointed in continue then.....At least in the current 
alpha some evaluation takes place.
     R3 ---  for n 1 5 1 [print n continue xxx: 999]
     R2 ---  for n 1 5 1 [loop 1 [print n  break xxx: 999]]
Both R2 and R3 end up with xxx as an unset word in system/words
Henrik
20-Jan-2009
[9692]
Sunanda try profiling the R3 version with and without the xxx word 
and see if there is a speed difference. If not, then the word appears 
due to binding on first use of the block.
[unknown: 5]
20-Jan-2009
[9693x2]
Not really evaulation as much as type checking possibly.  Even the 
following will add to the system/words:

>> loop 1 [break blah: 1]
>> find first system/words 'blah
== [blah]
I think system/words is similiar to a string table as found in other 
languages with respect to literals.
BrianH
20-Jan-2009
[9695x2]
CONTINUE has the same overhead as BREAK, EXIT and RETURN, so be sure 
to factor that in in your performance calculations.
It can be really convenient though :)
[unknown: 5]
20-Jan-2009
[9697]
What overhead?
BrianH
20-Jan-2009
[9698x3]
It's similar to a THROW, setjump/longjump overhead mostly.
That is why returning a value as the last expression of a function 
is faster than using the RETURN function.
REBOL isn't compiled so it's not the same thing as in a native language.
Chris
20-Jan-2009
[9701x2]
Brian, is it possible to expand on that (setjump/longjump), or is 
there a Carl post that summarises?  This is good to know - specifically 
as it relates to R2 and R3 implementation...
For example, [return true] vs [true] or ["a" exit | other rule]
BrianH
20-Jan-2009
[9703]
It's the same in R2. PARSE is diifferent though, but exit or return 
in the parens has the same overhead.
[unknown: 5]
20-Jan-2009
[9704]
I don't see how the overhead of continue would be greater than the 
overhead of further evaluation where it isn't used.
Sunanda
21-Jan-2009
[9705]
I tried timing tests on my R2 ad R3 examples.
R3 runs in about half the time. 

Conclusion: 'continue is a good optimisation over loop 1 [...break...]

That does not say anything about the overheads of 'continue.....Just 
that an extra loop is an extra overhead.
Oldes
21-Jan-2009
[9706x2]
>>  loop 1 [break blah: 1 blahblah: 2]
>> find first system/words 'blahblah
== [blahblah]
I think that Rebol first must parse the block to evaluate into 'tokens', 
that's why the words are defined as unset in the system/words
DideC
21-Jan-2009
[9708x3]
Exactly. It must load the block, so create the words. Then it can 
do it.
REBOL/View 2.7.6.3.1 14-Mar-2008
Copyright 2000-2008 REBOL Technologies.  All rights reserved.
REBOL is a trademark of REBOL Technologies. WWW.REBOL.COM
>> load [blah: 1]
== [blah: 1]
>> find first system/words 'blah
== [blah]
>> blah
** Script Error: blah has no value
** Where: halt-view
** Near: blah
REBOL/View 2.7.6.3.1 14-Mar-2008
Copyright 2000-2008 REBOL Technologies.  All rights reserved.
REBOL is a trademark of REBOL Technologies. WWW.REBOL.COM
>> loop 1 [break blah: 1]
>> find first system/words 'blah
== [blah]
>> blah
** Script Error: blah has no value
** Where: halt-view
** Near: blah
Anton
21-Jan-2009
[9711]
By the way, doing

	find first system/words 'any-word-you-like


will always succeed, because before the console evaluates this line, 
it first loads it, so the word will be added, and thus, be found.