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

World: r4wp

[#Red] Red language group

Rebolek
18-Sep-2012
[1953]
Pekr, if you are interested what action!s and native!s are currently 
available, I wrote simple parser that goes thru %actions.reds and 
%natives.reds and outputs list of all implemented functions.
Kaj
18-Sep-2012
[1954x2]
I've added Red versions of Fibonacci and Mandelbrot to my C library 
binding, but they're just the Red/System code inlined in Red, with 
the timing code stripped out because I can't import the C binding, 
and Mandelbrot doesn't compile yet
Is there any meaningful Red code I can show tomorrow?
DocKimbel
18-Sep-2012
[1956x2]
Only the examples I posted above yesterday night.
We don't even have proper string! support yet. I plan to implement 
it this week.
Kaj
18-Sep-2012
[1958x2]
I'm trying to wrap my GTK dialect in a context, but I'm hitting more 
context bugs
So it's going to be a traditional Red/System presentation, with little 
Red and contexts
DocKimbel
19-Sep-2012
[1960x3]
I've been very busy since yesterday on a new tool for Red: I've built 
a proper REBOL code profiler! (I wonder why I haven't done that since 
a long time...). I went through the profiler scripts on rebol.org 
and couldn't one suitable for my needs or that works with complex 
code, so I wrote one. It is able to deal with complex code, all datatypes, 
recursive calls and it's very simple to use.


Here's a demo profiling Red compiler (output is properly aligned 
when monospace font is used):

-= Red Compiler =-
Compiling red/tests/test.red ...

...compilation time:     40 ms

Compiling to native code...

...compilation time:     10189 ms
...linking time:         60 ms
...output file size:     37888 bytes
>> profiler/report/time


Function                       Count      Elapsed Time         % 
of ET

------------------------------------------------------------------------

compile                        1          0:00:10.249          100.0

comp-dialect                   205        0:00:09.659          94.24

fetch-expression               7505       0:00:09.628          93.94

comp-word                      5668       0:00:08.209          80.09

fetch-into                     427        0:00:07.519          73.36

comp-assignment                597        0:00:07.049          68.77

run                            3          0:00:06.492          63.34

comp-context                   21         0:00:06.398          62.42

comp-with                      1          0:00:05.565          54.29

comp-expression                3172       0:00:04.479          43.70

ns-find-with                   24277      0:00:03.962          38.65

finalize                       1          0:00:03.327          32.46

comp-natives                   1          0:00:03.274          31.94

comp-func-body                 180        0:00:03.271          31.91

comp-call                      2775       0:00:02.732          26.65

comp-func-args                 2861       0:00:01.862          18.16

find-aliased                   9650       0:00:01.86           18.14

resolve-type                   8032       0:00:01.799          17.55

get-type                       10758      0:00:01.546          15.08

ns-prefix                      21765      0:00:01.518          14.81

check-enum-symbol              7509       0:00:01.241          12.10

comp-block                     283        0:00:01.05           10.24

comp-variable-assign           417        0:00:01.034          10.08
The overhead of the current implementation is about 5-6 times the 
program execution time, so it's very usable. I will publish it today, 
and I hope someone will pick it up to improve it and add features 
(like a GUI front-end for the reports, with sortable columns).
BTW, as I was thinking, the above compiler profiling confirms that 
aliases and namespaces support are quite costly currently (ns-* functions). 
So now I know where to improve the code for better performances (not 
that it matters for the users currently, but it matters to me as 
I need to run the whole test suite dozens of time each day, and with 
the addition of now Red compiler, it (and will) adds up to a lot 
of waiting time at the end of the day).
Gregg
19-Sep-2012
[1963]
That's great Doc!
DocKimbel
19-Sep-2012
[1964]
REBOL code profiler released: https://github.com/dockimbel/Red/blob/v0.3.0/red-system/utils/profiler.r


Should work with any REBOL app. Documentation, comments and example 
included in file header.


Hope someone will pick it up and improve it (like adding functions 
sub-tree stats and a GUI). This is github, so feel free to fork then 
fix/improve.
Pekr
19-Sep-2012
[1965x3]
Doc - your twitter account got spammed?
Calculator Hero lets u fulfil challenging computing tasks with simplest 
operations!! DOWNLOAD NOW 4 iPad ver. 
Or is that new secret Red app for iPad? :-)
DocKimbel
19-Sep-2012
[1968x3]
Thank...has my password been cracked or are they means to post in 
name of someone else?
(tweet deleted)
I've changed my password just in case.
Arnold
19-Sep-2012
[1971x3]
Can someone tell me why for example in https://github.com/dockimbel/Red/blob/v0.3.0/red-system/utils/profiler.r
to use 

set 'make-profitable func [][] instead of make-profitable: func [][] 

because the second kind of declaration is also use in this script 
and I do not see why both are being used; you have a preference for 
one over the other so you use one, not both?
set 'make-profitable func [][] instead of make-profitable: func [][] 
the link overwrites this line in my version of AltMe sorry!
This also was meant for Rebol-school. Closing down AltMe and restart.....
Pekr
19-Sep-2012
[1974x2]
Arnold - that's the old altme url bug. In order to be able to read 
such lines, just change the size of text for a while (aA button above 
the text field)
Arnold - 'set example is one trick you can use in REBOL. Normally, 
when you enclose the function in the object/context, it is accessible 
via a path notation, e.g. context/make-profitable. When you use 'set 
aproach, it lives inside the context, but is exposed to the global 
context, so you can call it directly, or something like that :-)
Arnold
19-Sep-2012
[1976]
Thank you Pekr. It is a little to subtile for my mind and current 
REBOL knowledge, I will have to live with this ;-)
DocKimbel
19-Sep-2012
[1977]
It's "make-profilable", not "profitable"...well at least, not yet. 
;-)
Arnold
19-Sep-2012
[1978]
LoL! I was totally unaware I changed that. :D
Pekr
19-Sep-2012
[1979]
:-)
DocKimbel
19-Sep-2012
[1980]
@Arnold: I've pushed an update to profiler and I've made nested functions 
exposition to global context more elegant. ;-)
Arnold
19-Sep-2012
[1981]
Maybe it is more profitable now :D
DocKimbel
20-Sep-2012
[1982]
Red FB group: https://www.facebook.com/groups/redlanguage/

My new public FB profil: https://www.facebook.com/redlanguage


Those that sent my friend requests recently to my private page, can 
now resend them to this new one.
MagnussonC
21-Sep-2012
[1983]
That FB Red avatar is rather ... blue
DocKimbel
21-Sep-2012
[1984x2]
Good point, I'll see how Doctor Manhattan renders in red shades. 
;-)
This is huge: http://www.pythontutor.com

We need to write Red documentation that way too!
Endo
21-Sep-2012
[1986]
Cool! (for FB group and pythontutor.com)
AdrianS
21-Sep-2012
[1987x2]
Really nice - I thought the examples were canned at first, and I 
was thinking how tedious it must've been to set these up, but I see 
that it's all generated on the fly.
I would've thought that trying to show so many things (program listing, 
output, data structures) in that amount of space would make it hard 
to follow - it's surprisingly clear, though.
Arnold
21-Sep-2012
[1989]
Well my patience is being tested. No red-lang mailing list for me 
for a week or more. Account disabled. (Red-terrorist :) )
Pekr
22-Sep-2012
[1990]
Ah, Unicode plan posted, should be announed here :-)

http://www.red-lang.org/2012/09/plan-for-unicode-support.html
Henrik
22-Sep-2012
[1991]
Any particular plan for error handling?
DocKimbel
22-Sep-2012
[1992x3]
Nothing in particular, I will implement it the same way as in REBOL. 
If you have suggestion about improvements, it's still time.
Error handling will come fast, probably next week, but in a basic 
version as we still don't have something like system/standard/*
Pekr: I guess that all people here interested in Red have subscribed 
to red-lang.org feed. ;-)
Pekr
22-Sep-2012
[1995x2]
yes, but? :-) You posted about FB group above ... which is part of 
the Twitter feed too :-)
what I liked about R3 errors was addition of 'why function, which 
pointed you to the docs :-)
Henrik
22-Sep-2012
[1997x2]
Pekr, yes, exactly one thing I'm missing about the current error 
system. Also currently user error strings are difficult to localize 
unless you use your own scheme, when displaying the error.
You can certainly carry this data in the arg1, arg2 and arg3 words, 
but it's a bit awkward.
Arnold
22-Sep-2012
[1999]
About error, maybe some indication of the line number. Not prominent 
but as a hint at least, however using find most of the time finds 
the right place where the error is, sometimes it is not so clear.
DocKimbel
22-Sep-2012
[2000x3]
Henrik: you're are passing REBOL errors to end users?
Line numbers: there are complicated and costly to handle in a REBOL-like 
language at runtime. The experimentation I did in Red/System confirms 
it. I'm not sure I will add them to Red unless we can come up with 
an efficient solution.
*they