File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Threads" Watch "Threads" New topic
Author

Threads

Geoffrey Chu
Ranch Hand

Joined: Feb 25, 2004
Posts: 70
Hi,

I am developing a ColdFusion/Ajax Framework that allows our other developers to create tab-screens to CRUD records into the database. I use AJAX to retrieve the tab pages and send the information to the server to be saved (without submitting). Now, performance is becoming a problem, so I was wondering what can I do to improve the performance of the framework. Threads and lazy loading will be nice to have. Any ideas on how to implement these features ?

Thanks and regards,
[ November 18, 2005: Message edited by: Geoffrey Chu ]

Geoffrey Chu<br />----------------------<br />- SCEA<br />- IBM UML OOAD<br />- SCJP 1.4
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
If you stick with an OO JavaScript, then yu will be able to perform multiple operations at the same time without much trouble.

Internet Explorer by default can only perform two connections to a given server at one time. Therefore if you make multiple requests to it, it will queue them up.

Eric
Geoffrey Chu
Ranch Hand

Joined: Feb 25, 2004
Posts: 70
Performance speaking, when using Javascript, what is the difference between developing the application function oriented vs. Object oriented ?

In other languages, Objects are fully loaded into memory while functions are loaded when called. Is it the same concept in JavaScript ?

Regards.
Stephen Cote
Greenhorn

Joined: Nov 11, 2005
Posts: 9
JavaScript is interpreted and functions and object prototypes will consume memory when parsed, or for dynamic script, when evaluated. The memory is supposed be freed when no other reference to that object or function still exists. You will incur additional memory use by creating new instances of objects or functions. The difference is how many instances and closures you create with those implementations. There are also a number of caveats among the various browsers that result in memory leaks, such as stray event handlers and pointers (refer closures) at the time the document unloads.

Another thing to keep in mind is that JavaScript is single threaded. Objects available to JavaScript, such as XMLHttpRequest and the Browser DOM, may be multithreaded, but JavaScript is on one thread, asynchronous or no. Any claim JavaScript multi-threading should be assumed to imply psuedo-threading, or asynchronicity. Even if a multi-threaded object calls into JavaScript, JavaScript will have to handle those calls on one thread.

You can browse around for pseudo-threading libraries, or I have one in my rather large client-side library.

As far as lazy loading, you can start by verifying you are making asynchronous and not synchronous XML requests. I have a Cross Browser XML Library you can reference to see if that helps out at all. It includes connection pooling and response caching.


Stephen W. Cote<br />wranlon@hotmail.com<br />http://www.imnmotion.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Threads