XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Speed in Languages and Browser Architectures

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.

 

<blockquote>

All this talk about speed.  There are so many factors that determine how long something is really going to take.

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 just making javascript calls in many cases.

Of course it all depends on what you are doing.

 

Here is a simple test.  http://vrmlworld.net/perftest/

 

It is a simple HTML page that includes my ABNet ActiveX client, my ABNet Java client and a simple

Javascript function.   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 it takes javascript to loop 50k times .. 20 - 30 ms The Javascript function on my machine runs in 270 ms ActiveX function takes 1700 ms Java function takes 11000ms

 

The javascript is so fast 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 do a lot of processing using javascript in the ABNet custom VRML nodes. I think it reduces the number of process context switches which increases responsiveness.  I load a chunk of VRML with scripts that "preprocess" events using javascript in the wrl wolrd before trying to notify the HTML browser.  Using this scheme, I can filter the users movement in VRML without having to switch context to a java, javascript or C++ activex object. 

 

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.

 

-rick

 

 

</blockquote>



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS