Given the recent threads on predictions and parsing speed, here
is a copy of a post made to the VRML list on the topic of speed and
performance. So many of the people here are dedicated database
wonks and thin-client developers, it is sometimes hard to see another point of
view relative to browser architectures and the mix of language and performance
needed by different applications.
This is from Rick Kimball on the topic of ‘which
language is faster’. Comments on this are invited.
All this talk about speed.
There are so many factors that determine how long something is really going to
You can't just make a
blanket statement that one language is going to be N% faster than another.
For what I'm doing, ABNet multiuser
3d server, I have tried using a variety of methods for sending TCP/IP
data over the Internet. What I've found is that the overhead of leaving
the VRML/HTML browser thread and marshalling data to java or C is slower that
Of course it all depends on
what you are doing.
Here is a simple test.
It is a simple HTML page
that includes my ABNet ActiveX client, my ABNet Java client and a simple
The page has a bunch of buttons that time how long each method takes. (To
run the test above, you need the ABNet client installed, a working java in your
browser, and Microsoft Internet Explorer).
I created a loop that
executes a simple 'version' function 50K times in each environment. Each
function just returns a string.
This test illustrates how
much time it takes actually to pass data from one language specific context to
another when using the HTML browser.
The emptyloop test how long
my machine runs in 270 ms ActiveX function takes 1700 ms Java function takes
because it probably doesn't even try to yield the CPU while you execute it.
The ActiveX is fairly fast
but it has to the marshall
the data from the COM object to the browser thread. I'm sure each time that happens,
it gives the OS a chance to yield the CPU to someone else. At least the
ActiveX object is just a DLL and running in the same process as the browser.
The Java is dog slow, why
because it has to marshall
the calls across two processes (iexplore.exe and java.exe) make the call and
return the marshalled data. Lots of context switching, process yield
opportunities and data marshalling going on.
I don't think people take in
to account how much time is spent when you switch from one execution thread to
another. This is especially important in VRML browsers when you are tracking
changes to say something like a proximity sensor. The more frequent the changes,the
quicker you need to get the changed values do something and return.
This is one of the reasons I
it reduces the number of process context switches which increases
responsiveness. I load a chunk of VRML with scripts that
to notify the HTML browser. Using this scheme, I can filter the users
From my experience, the
longer you do what you are doing where you need to do it, the better off you
are. Even if that means using a script language built into the VRML
thread you are in.
Any insightful comments from
browser developers would be appreciated.