Comments on: Better DO performance

Carl Sassenrath, CTO
REBOL Technologies
21-May-2007 18:12 GMT

Article #0089
Main page || Index || Prior Article [0088] || Next Article [0090] || 4 Comments || Send feedback

As I mentioned earlier, the do function shifted from a native function to mezzanine in R3. This change was made to move higher-level code, such as do on an HTTP request, to REBOL code, not C. For example:


The do overhead of this code is insignificant compared to the read overhead of the HTTP request itself.

But, do is polymorphic over all datatypes, so the above change meant that an evaluation as simple as:

do 1

would suffer the mezzanine evaluation overhead. As you would guess, that did not settle well with me...

So, I've reverted do back to being a native. This was made possible by the new system/intrinsic function dispatch methodology which is used for actions such as make on a port or module. It allows a native to call back into REBOL code for complex actions that are better off written at the higher level.

Here is a performance comparision for evaluating:

loop 1'000'000 [do 1]

on both R2 and both ways on R3:

REBOL 2.7 native 0.3 sec baseline
REBOL 3.0 mezzanine 2.4 sec 8 times slower
REBOL 3.0 native 0.125 sec twice as fast

Although do would rarely be put in a tight loop like this, it shows the benefit. The change was worth the effort (which was minimal anyway), and also retains the higher level do evaluation of URLs, files, etc. (And, that code can be customized by applications, as needed.)

An additional benefit is that the eval native becomes unnecessary. (And, I never liked that native.) Also, this change also allows removing the cause function for errors (becomes unnecessary).



Brian Tiffin
21-May-2007 16:08:36
It would have slowed down forskip as well. At least the forskip in R2. I like the change and the new timings.


Brian Hawley
21-May-2007 17:09:06
Will there still be an apply native? What changes to error evaluation prompted the removal of cause? "Cause" was too general a name for that function anyways...
21-May-2007 17:32:58
Request: Blog article on system/intrinsic. Thanks. :-)
Vladimir Jankovic
1-Jun-2007 4:21:52
Nice improvement :) Good to see rebol is becoming faster and better!

Post a Comment:

You can post a comment here. Keep it on-topic.


Blog id:



 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

Updated 27-May-2024 - Edit - Copyright REBOL Technologies -