realbasic-games
[Top] [All Lists]

Re: Alternate 3D

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Alternate 3D
From: Nick Lockwood <nick at charcoaldesign dot co dot uk>
Date: Sat, 14 May 2005 11:12:29 +0100
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <BEAB0B16 dot 2FD5%acuipka at statrite dot com>
Polymorphism and dynamic binding are nothing to do with each other, at least not in the context Chris is talking about.

The dynamic binding he means refers to the linker-level operations performed by the operating system in order to connect programs with shared libraries of code.

Chris is an experienced coder and a long time contributor to these forums, flaming him because you missed the point of what he is saying is ill advised.

Going back to the original point that Chris was making, ease of use doesn't imply inefficiency. The underlying implementation of REALbasic should be capable of matching the performance of any of these other development environments. REALbasic compiles into platform-native machine code which is (at least in principle) the most efficient executable format. Compare this to Java which compiles to virtual bytecode which must be effectively *emulated* by a virtual machine on each platform, and it becomes reasonable to question why REALbasic is so slow.

I've done some playing with C code and managed to write a simple virtual machine that loops through a set of instructions stored in array and "executes" them by selecting functions in a switch statement. I was gob-smacked to find that in a simple looping example, the performance of this crude un-optimised VM was actually almost identical (and slightly superior) to REALbasic. Actually, to do a fair test I compared my code with an RB loop of the form:

dim i as integer = 10000
start:
i = i - 1
if i > 0 then goto start

when I compared it with the equivalent empty for loop then the performance of REALbasic was about half that of the VM.

So not only is RB's compiled code slower than a crude VM, but even simple loop structures are poorly optimised compared to implementing the loop manually.

I have to wonder where this inefficiency is occurring. The usual story that RB has to implement everything using cross-platform libraries doesn't really wash when the construct being implemented is something as simple as above that should compile to half a dozen machine instructions or less, and makes no library calls.

Perhaps Mars would like to explain how (and why) a loop such as the one above is compiled in RB...?

Nick


On 14 May 2005, at 09:55, Adam Cuipka wrote:


I really do not know how to reply to your comments Chris. I think it is
self-evident that your grasp on the details is a little simple.

It seems that you want all the power and speed, but are not willing to sacrifice the simplicity and almost worry-free programming environment of
REALBasic.  It doesn't make any sense.

    And, if I may state Chris, REALBasic, Java, and Objective-C all use
dynamic binding.  For example, consider the following object heirarchy:

LifeForm->Animal->Dog->Border Collie

This means that Border Collie can respond to messages sent to any of its
four interfaces.  Basic Polymorphism.  Consider this:

    dim myLifeForm as LifeForm

    myLifeForm = createRandomLifeForm() //plant, fish, dog, cat, chris

    myLifeForm.die() //calls some sort of die.

    Polymorphism -> Dynamic binding. Comp Sci 101

Adam


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>