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

World: r3wp

[Core] Discuss core issues

btiffin
18-May-2007
[8030x2]
BrianH;  I like to idea of using a REBOL to rebcode dialect.  JIT 
for developing.
Pre "compiled" for released scripts.
to = the / your
Dockimbel
18-May-2007
[8032x2]
I guess that only a (small?) subset of REBOL semantic rules can be 
compiled to rebcode or native code. Maybe Brian has already defined 
that subset during his research.
(i mean, without resorting to some level of runtime evaluation)
Oldes
18-May-2007
[8034]
rebol to rebocode compiler would be very usefull for math functions 
and image manipulations
Rebolek
18-May-2007
[8035]
rebcode math is faster than rebol, but C math is still lightyears 
awonder how big is smallest C compiler
Oldes
18-May-2007
[8036]
for example I would like to see this equations as rebcodes http://www.robertpenner.com/easing/penner_easing_as2.zip
BrianH
18-May-2007
[8037]
There is nothing really sacrosanct about the DO dialect's semantics. 
A compilable dialect could have different semantics that would be 
similar enough at the high level for most programmers to not have 
to change most of their code.
Rebolek
18-May-2007
[8038]
lightyears awonder = lightyears ahead. I wonder...
BrianH
18-May-2007
[8039]
RT did something similar when they switched from R1 to R2. They switched 
from a Scheme-like engine to a Forth-like engine and most code was 
able to run without changes.
Pekr
18-May-2007
[8040]
The question is, if such change can be done now? Or do you have just 
special subset of rebol language functionality having available to 
those who wish to compile?
BrianH
18-May-2007
[8041]
Doc, my research has been put on hold waiting for R3. I can't justify 
using REBOL as a primary platform at work until I can make it integrate 
better with Microsoft technologies. Plus, they put rebcode on hold 
before they resolved the security/stability issues.


This research is going to have to be a spare-time thing for me for 
now, and I won't have any of that until after summer.
Volker
18-May-2007
[8042]
For one, i dont do stuff like in Gabrieles examples, dso if they 
perform terrible, i dont worry :)

For the ability, hotspot can do the following: it analyses the current 
code, sees, the is a virtuall call . but only one class with that 
method. and inlines the method. Later more code is loaded. now there 
are two classes, and the call must be really dispatched. Yes, it 
can change the code. I think that is somewhat similar to GAbirles 
changing of 'print.

For a/b, self did that long ago. it started with very flexible code, 
which checkt for object function and so on. keept track of what really 
occured. and generated optimized versions for the common cases. some 
runtime-checks for types, and branching to the quick version most 
of the time. quite fast results.
BrianH
18-May-2007
[8043]
There's even solutions to combining type inference and partial evaluation 
that can make dynamic languages mostly static, and you can use type 
inference to make static languages that look like dynamic languages 
on the surface.
Dockimbel
18-May-2007
[8044]
Brian, what kind of integration with MS technologies do you lack 
the most ?
BrianH
18-May-2007
[8045x7]
Native library access to C is not enough, I need fast COM and .NET 
integration. Now that the DLR is out I may be able to implement the 
.NET stuff, when I get the time. With plugins and user-defined data 
types I could integrate COM. Mostly I would like to use /Services 
and I can't unless I can call them from .NET, or serve up .NET services 
to REBOL quickly. I think the lower overhead compared to SOAP would 
be a plus, but it has to be seamless, and as fast as local services 
when running on the same machine.
Cross-platform is not a problem for me - I can use Mono if I need 
to.
It would also be a plus to have proper WinCE support, as many of 
the people I support are running it in their cell phones. J2ME would 
be good for many others.
For instance, there are many REBOL desktop and network apps that 
would be much more useful with ActiveSync support (Qtask).
The ActiveSync APIs use COM.
Any proper WinCE app that stores data locally would need some kind 
of syncronization support too.
I would love to replace Outlook with Qtask, but can't without ActiveSync 
support.
Dockimbel
18-May-2007
[8052x2]
The ActiveSync protocols have been reverse-engineered by the SynCE 
project team (http://www.synce.org/index.php/SynCE-Wiki). It should 
be possible to make an implementation in REBOL.
Reichart should pay someone to implement ActiveSync support.
BrianH
18-May-2007
[8054]
Well, SynCE will help if I am connecting to WinCE from a non-Windows 
machine, but the ActiveSync program is already doing the connection 
on Windows, so I will have to integrate with that. Same on the WinCE 
side.
Terry
20-May-2007
[8055x4]
>> r: does [recycle set 'a "11111111" system/stats]
>> r
== 4460038
>> r: does [recycle set 'a 11111111 system/stats]
>> r
== 4460038
>> r: does [recycle set 'a ["1 1 1"] system/stats]
>>r
== 4460518
>> r: does [recycle set 'a [1 1 1] system/stats]
>> r
== 4460518
so.. is it fair to conclude that integers take up the same amout 
of memory as strings?
>> a: 1
== 1
>> to-binary a
== #{31}
>> a
== 1
>> a: "1"
== "1"
>> to-binary a
== #{31}
>> a
== "1"
Sunanda
20-May-2007
[8059]
It may be fairer and more accurate to say REBOL has some subtle optimizations 
in its memory allocation.

Watch, for example, the memory drop here.....you'll see that as the 
block 'x grows, REBOL allocates space in anticipation, so a single 
insert into 'x does not always change the stats.
x: copy []
st: system/stats
loop 500 [
    print [(st - system/stats) length? x]
    append x length? x
    recycle
   ]
Terry
20-May-2007
[8060x3]
>>r: does [recycle set 'a [#{7FFFFFFF}] system/stats]
>> r
== 4559204

>> r: does [recycle set 'a [6442450943] system/stats]
>> r
== 4562852
the first is the binary version of the second integer..  safe to 
say that a binary uses more mem than the integer?
Im trying to determine the most memory efficient method of storing 
a large block of numbers (can be integers, bits.. i dont care, as 
long as i can convert it to an integer in the end)

Also cosidering the best storage for finding a particular binary 
or integer in the block?
Anton
20-May-2007
[8063]
A binary does use more than an integer, but the above doesn't prove 
it. You're only checking one value. As Sunanda wrote, rebol's memory 
allocations are not obvious. It uses pools of memory, which allows 
reuse of memory.
Terry
20-May-2007
[8064]
why would a binary use more mem.. shouldn't it be the other way around?
Sunanda
20-May-2007
[8065x2]
Gabriele has explained it previously, something like this:
Values life in "value slots". Words point to value slots.

Some values live entirely in their value slot -- chars, integers: 
ie the short ones with a determinate maximum length.

Other values live in memory pointed to the by value slot -- such 
as strings.
There is memory allocation optimisation both for value slots (as 
seen in the growing block of integers example above), and elsewhere.

So a single allocation is not enough to deriive the underlying algorithm.
Anton
20-May-2007
[8067]
And a binary is just a type of string, so yes, the value slot contains 
a pointer to the actual data.
Sunanda
20-May-2007
[8068]
Value slots are always 16 bytes long in current REBOL versions (Says 
Gabriel).

It seems reasonable to assume this will increase if REBOL goes 64bit 
(speculates Sunanda)
Terry
20-May-2007
[8069]
so then a block of integers  ie: [1234432   345   45345   5435   
2345  5435353]  .. .
is the most efficient way to store?
Anton
20-May-2007
[8070]
Storing a bunch of integers in a binary should be more efficient, 
only one value slot used, and each integer takes only 32bits.
Terry
20-May-2007
[8071]
I guess that's my point.. i need to use 32 bits to store a single 
integer??
Anton
20-May-2007
[8072x2]
What precision do you need in your integers ?
You could make 8-bit or 16-bit, or ... 13-bit integers if you wanted. 
It's more work, but possible.
Terry
20-May-2007
[8074]
i can use bits.. where 00= 0   01 = 1  10 = 2 .. 11 = 3  etc.
Anton
20-May-2007
[8075]
Yes, how many bits per integer are needed ? What's the highest number 
? Any negative numbers allowed ?
Terry
20-May-2007
[8076]
( 0 = 0 rather)
Anton
20-May-2007
[8077]
(ie. how many unique integer values are needed ?)
Terry
20-May-2007
[8078]
no negatives..  and a MAX of 32 bits is more than enough for the 
largest number
Sunanda
20-May-2007
[8079]
A value slot is 16 bytes, so  a single integer takes 16 bytes -- 
it has to live in a value slot.