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

World: r3wp

[!REBOL3]

Maxim
20-Dec-2010
[6682]
easily checked with a little powers of two loop ;-0
Henrik
20-Dec-2010
[6683]
don't have the memory :-)
Steeve
20-Dec-2010
[6684]
have a break :-)
Henrik
20-Dec-2010
[6685]
I'm writing docs. Just getting warmed up. :-)
Sunanda
20-Dec-2010
[6686]
Max word lenth is 255 or 256 in R3
Henrik
20-Dec-2010
[6687]
ok, thanks. that's fair enough.
Sunanda
20-Dec-2010
[6688]
http://www.curecode.org/rebol3/ticket.rsp?id=580&cursor=1
Steeve
20-Dec-2010
[6689]
Btw Henrik, I read your GUI R3 code. It's R2 fashioned. You missed 
some R3 tricks. I suppose you already know it though ;-)
Henrik
20-Dec-2010
[6690]
Steeve, depends on which parts you read.
Steeve
20-Dec-2010
[6691x4]
I give some examples.
The 'merge-values mezz is actually like the native 'resolve
you use a lot the old idiom
select block 'word 
vs
block/:word (which is faster and more compact)
(sorry it's: select block word)
Henrik
20-Dec-2010
[6695]
it's quite possible that some functions are from the original R3 
GUI, long before newer tricks were involved.
Steeve
20-Dec-2010
[6696x2]
Another old R2 idiom:
all [in object 'property object/property]
vs
select object 'property
var: either cond [...][none]
vs
var: if cond [...]
Henrik
20-Dec-2010
[6698]
hmm... yes, that is old
Steeve
20-Dec-2010
[6699x5]
But you know, We all are in the same trend, It will take a while 
before we loose old habits
Today, I saw something horrific in an old script of mine.
>> 8 * to-integer v1 + v2 / 8
V1 and V2 are actually integers
(not related specificaly to R3)
I let you think about this coding horror ;-)
Kaj
20-Dec-2010
[6704]
Was that R1 semantics? ;-)
Gregg
20-Dec-2010
[6705]
I wouldn't always use the IF version in place of EITHER. I generally 
prefer to be explicit.
BrianH
20-Dec-2010
[6706]
We use that IF or UNLESS returning none trick a lot. It is used so 
much that it might as well be considered explicit. It is good to 
remember that REBOL doesn't have an optimizer; we have to optimize 
by hand, and the IF trick is faster than the explicit EITHER.
Gregg
20-Dec-2010
[6707]
It is used so much that it might as well be considered explicit.

As is my preference for avoiding premature optimization. ;-)
BrianH
20-Dec-2010
[6708x5]
On that note: Steeve...
>> a: [a 1]
== [a 1]
>> a/:b
** Script error: :b has no value
>> select a 'b
== none
It's the same thing as the SELECT object word trick.
Gregg, don't avoid optimization altogether in the name of avoiding 
"premature" optimization :)
A better aphorism to use here would be to avoid being "penny wise 
but pound foolish" - it makes your point better :)
Gregg
20-Dec-2010
[6713]
Agreed on optimization being required at times. Not loading lots 
of data? Yes. Using a hash instead of a block? Yes. I have even avoided 
the mezz loop constructs at times, though more often for clarity 
than performance. 


Maybe I'm a special case, but I have rarely found the need to optimize 
my REBOL code for performance at this level. And I can safely say 
I have never ever, ever optimized out EITHER for IF. Since you said 
it's used a lot, what code should I look at to see how and why? I'm 
always happy to see what I've been missing.
BrianH
20-Dec-2010
[6714]
It's used in mezzanines, for instance. I tend to just write code 
in micro-optimized form in the first place, since it is easy to do 
and saves you the trouble of doing it later. Even if you are macro-optimizing 
the code (refactoring and such) you tend to use the same micro-optimizations 
in the new code. For that matter, many of the changes and enhancements 
in R3 were done to make micro-optimized code cleaner to read and 
write than they are in R2. But I mostly write library and mezzannine 
code nowadays, so micro-optimization has greater impact than it would 
for user-level code.
Ladislav
20-Dec-2010
[6715]
Two notes:

- I optimize for code size, using IF, or UNLESS

- the average speed-up looks like being about 27%, though, which 
is worth considering
BrianH
20-Dec-2010
[6716x2]
Interesting: That's the same speedup that referencing words from 
object contexts gives you, relative to function contexts.
Agreed: Less code means less code to maintain and debug :)
Ladislav
20-Dec-2010
[6718]
I wonder, what is the purpose of the --- function, did not suceed 
to find that out.
BrianH
20-Dec-2010
[6719]
>> same? :--- :comment
== true
Ladislav
20-Dec-2010
[6720x2]
aha, thanks
I hope, though, that everyone will use the word COMMENT.
BrianH
20-Dec-2010
[6722]
I expect that Carl added it to be able to write more concise code. 
I prefer COMMENT too though.
Gregg
20-Dec-2010
[6723]
I tend to just write code in micro-optimized form in the first place

And do you consider that premature optimization, or not?
BrianH
20-Dec-2010
[6724]
It is just as easy in theory to write the code in micro-optimized 
form as it is to not, so why not? In practice though, in R2 it is 
harder to write micro-optimized code (for various reasons). In R3 
it is *easier* to write micro-optimized code than it is to not, because 
we have been deliberately been optimizing the language for just that 
effect for a couple years now.
Maxim
20-Dec-2010
[6725]
in R2 I use none of the mezz loops(they really slow down code), now 
that they're all native, I have much more options in R3.
BrianH
20-Dec-2010
[6726]
What's more, we have been working to make the behavior of the language 
much more consistent between datatypes, so it is now easier to make 
macro-optimizations like changing datatypes without needing to change 
the code that uses them. This is why the SELECT trick for objects 
works the same as it does for blocks, for instance.
Kaj
20-Dec-2010
[6727]
Pity I can't use any of it, because I still need to run on Cheyenne
BrianH
20-Dec-2010
[6728]
I ran into the same problem, which is why I made R2/Forward.
Kaj
20-Dec-2010
[6729]
Yes, that helps
BrianH
20-Dec-2010
[6730]
One side effect of "premature optimization" is that micro-optimized 
code patterns in the R3 mezzanines that looked bad or required explanation 
to Carl often led to improvements in the language to make those micro-optimizations 
unnecessary. Lots of ease-of-use improvements in R3 came about because 
of this.
Kaj
20-Dec-2010
[6731]
I don't know if you can call that premature, after thirteen years 
:-)