• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[#Red] Red language group

Kaj
22-Nov-2012
[4260x2]
I fixed the compile bug in World, so Kaj's Fibonacci test now takes 
8.7s to run in World on my machine. R2 takes 17s and C less than 
1s.
Those results are quite similar to Red's current performance
Pekr
22-Nov-2012
[4262]
Is World being compiled?
Kaj
22-Nov-2012
[4263]
Yes
Arnold
22-Nov-2012
[4264]
I understand that the 2 times faster than R3 includes the compile 
of the Fibonacci program? 

No the performance of the Red program is a bit dissappointing at 
a first glance for the programsource is not very different from that 
in Red/System?
Henrik
22-Nov-2012
[4265]
Similarity between the two is not so easily related, as Red is more 
dynamic than Red/System.
DocKimbel
22-Nov-2012
[4266]
the performance of the Red program is a bit dissappointing

 Maybe I should have kept Red project secret until v1.0 to avoid "deceiving" 
 people who thinks that any v0.x version should be equal to a v1.0...;-)
Arnold
22-Nov-2012
[4267]
Well the compile is not a simple 1-to-1 translation. 

I am glad you did not keep it a secret, I enjoy seeing the developments. 
And it IS already faster then R3! :D
DocKimbel
22-Nov-2012
[4268]
The speed difference with R3 is not a constant, the more code you 
put in the loop, the bigger the speed difference.
Jerry
22-Nov-2012
[4269]
Doc, can you make both MOLD and LOAD support /BINARY refinement to 
input/output Redbin format?
Kaj
22-Nov-2012
[4270x2]
Arnold, the time does not include the compilation. That's a one-time 
operation, so it would be unusual to include it
For World, it does include the compilation, because its operation 
mimics an interpreter
DocKimbel
22-Nov-2012
[4272]
AFAIK, World compiles to bytecode, then runs the bytecode in an interpreter.
Kaj
22-Nov-2012
[4273]
Yes, rather different model
DocKimbel
22-Nov-2012
[4274]
Jerry: it's a bit premature, but yes, that should be the way to create 
and consume redbin data. You can also add SAVE to that list.
Pekr
22-Nov-2012
[4275]
I gave the topic of the "speed" more thoughts, and though I am very 
uneducated in lower level internals and language designs, I think 
that I might have more understanding, why I can't think about Red 
being just a compiler to Red/System in a 1:1 manner. In such a case, 
Red would not be needed. What needs to be included in the final exe 
is kind of "engine", supporting stuff like GC, all the dynamic things, 
type checking engine, etc etc. 


When I ask myself, if I am willing to exchange dynamic stuff for 
speed, I say - no, at least not necessarily. It was just that I got 
trapped by first R/S performance tests, and thinking that if Red 
compile, it has to be almost that fast too.


As for waiting for 1.x and possible optimisations - I don't believe 
optimisations can change things drastically, at least non in order 
of a magnitude. But - we will see.
PeterWood
23-Nov-2012
[4276]
Personally, I feel that Google's V8 & Apple's Nitro give orders of 
magnitude speed improvements over early JavaScript Compilers.
Pekr
23-Nov-2012
[4277]
Peter - in the case of JS engines - is that only about the compilers, 
or also about an overal architecture change?
DocKimbel
23-Nov-2012
[4278]
Pekr: there are several layers at which optimizations can be applied. 
With an optimizing Red/System compiler, you'll already get an overall 
x2-4 boost. Then optimizations at Red level can bring us another 
boost (runtime code can be optimized, compilation output can be optimized 
to be closer to 1:1 with Red/System, when possible). The end result 
should give us, on average, a x10-20 boost over R3. I am pretty confident 
that this can be achieved, given the current results.
Pekr
23-Nov-2012
[4279]
Will also "self-hosting" - rewrite of Red/System in Red, help too 
in that regard? Or is that unrelated?
DocKimbel
23-Nov-2012
[4280x3]
Not really on the run-time performance, it will boost compilation 
time only. The main motivation for being self-host is the JIT-compiler 
(we need to embed the target compiler in Red runtime).
Today's new features:

- FIRST, SECOND, THIRD, FOURTH, FIRTH and LAST functions added.
- Paren! datatype added.
- Compilation of parens expressions now supported.
You should now feel a bit more "at home" with Red. ;-)
Henrik
23-Nov-2012
[4283]
SIXTH, SEVENTH, EIGHTH and NINTH also exist in REBOL. :-)
Pekr
23-Nov-2012
[4284]
yes, they do, but - have you ever used them? :-)
DocKimbel
23-Nov-2012
[4285x2]
I have used FOURTH once or twice, a long time ago, never used others 
above that.
(should be FIFTH, sorry for the typo)
Henrik
23-Nov-2012
[4287]
Pekr, no, but they should still be available, if any scripts use 
them. The cost of adding them should be very small.
DocKimbel
23-Nov-2012
[4288x2]
Have you ever seen source code that use such accessor above FIFTH?
I won't add them if nobody uses them, no matter the light cost.
Henrik
23-Nov-2012
[4290x5]
I would certainly wonder why you stop at FIFTH.
SIXTH is used in some of the REBOL/Services source, written by Carl.
And his way of using it might be a good argument for continuing up 
to NINTH.
Example:


; Packet header values (keep in-sync with load-header and mold-packet):
ph-version?: :second
ph-session?: :third
ph-encode?:  :fourth
ph-req-len?: :fifth
ph-pay-len?: :sixth
TENTH is there too.
DocKimbel
23-Nov-2012
[4295x2]
Now that you mention it, I remember seeing that code. Such code won't 
compile until we get JIT-compilation.

I would certainly wonder why you stop at FIFTH.

Why stop at TENTH? :-)
Any occurrence of above FIFTH usage in other than Carl's code?
Henrik
23-Nov-2012
[4297]
We have 10 fingers.
DocKimbel
23-Nov-2012
[4298]
If you count toes too, that makes it 20. :-)
Henrik
23-Nov-2012
[4299]
I'm serious. I think his idea was that real beginners should have 
a good idea on picking values from code.
DocKimbel
23-Nov-2012
[4300]
It doesn't make much sense to me to add features that nobody will 
use, just because we can add it, doesn't mean we should. For beginners, 
if they can't get a good picture on picking values with accessor 
up to FIFTH, I can hardly think that adding more will be of any help. 


The only reason for having them is the above code pattern used by 
Carl, but it can't be used for now in Red. Also, users are free to 
add more accessors names in their own code if they feel the need 
for it.
Endo
23-Nov-2012
[4301]
I've used FIRST, SECOND, THIRD, LAST and PICK for all the rest. It 
is even difficult to remember the name of the others as English is 
not my native language.
Henrik
23-Nov-2012
[4302]
Actually REBOL had only up till FIFTH below Core 2.5. After 2.5, 
SIXTH through TENTH were added. Here's why:

http://www.rebol.com/docs/changes-2-5.html#section-21
DocKimbel
23-Nov-2012
[4303]
Right, upper ordinal names were added in 2.6:

http://www.rebol.com/docs/changes-2-6.html#section-17
Henrik
23-Nov-2012
[4304x2]
that nobody will use

 - I don't buy that, since I only just now realized this is a good 
 way to produce certain types of more readable code. This means I 
 might start using SIXTH through TENTH more often.
(one can learn a lot by reading Carl's code)
BrianH
23-Nov-2012
[4306x2]
I could use ordinals all the way to TENTH. It is a common practice 
in advanced REBOL code to assign these ordinals to other words that 
are used as local accessor functions for series-based data structures. 
Using those accessor functions makes the intent of the code written 
with them much easier to understand. This is a trick that Carl and 
I use pretty often, and the reason he defined ordinals that high 
ion the first place even if only the earlier ones tend to be used 
directly.
Ah right, Henrik already posted an article with the reasoning. Good 
to know when they were added, it will help with R2/Forward.
Arnold
23-Nov-2012
[4308]
Why stop at tenth?
 :) 

agreed hundreth seems more appropriate, let alone spelling of all 
of them 
Own aiiases can be added or not?

This bring up the case that Kaj likes 'length-of' like names. These 
could also be supported aliases as I see it, right?
BrianH
23-Nov-2012
[4309]
If by "aliases" you mean multiple words with the same values assigned 
to them, or something like C-style typedefs, then yes. If by "aliases" 
you mean the multiple-spelling words generated by R2's ALIAS function, 
then please no. R2-style aliases that aren't limited to spelling 
differences that only differ in character casing have proven to be 
a bad idea.