Q:

Fastest way to get data from server up to Javascript

So the program I'm working on give the user possibility to view different Javascript implemented graphical representation (using WebGL, JIT etc.) of various data. The server side is written in python, and uses cherrypy with genshi + buffet. 
The problem is that many of the files are really big and the time it takes for the actual data to reach Javascript is starting to be a problem.
The approach so far is to have a server-side exposed cherrypy method:
@cherrypy.expose 
@logged()
def read_server_file(self, coded_path):
    """
    Retrieve file from Local storage, having a File System Path.
    """
    try:
        my_file = open(url2path(coded_path), "rb")
        result = my_file.read()
        my_file.close()
        return result
    except Exception, excep:
        self.logger.error("Could not retrieve file from path:" + 
                          str(coded_path))
        self.logger.exception(excep)

This just gets the actual file on the disk and returns the data from the file. And in the client side:
function getFile(fileName) {
    oxmlhttp = null;
    try {
        oxmlhttp = new XMLHttpRequest();
        oxmlhttp.overrideMimeType("text/plain");
    } catch(e) {
        try {
            oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            return null;
        }
    }
    if (!oxmlhttp) return null;
    try {
        oxmlhttp.open("GET", fileName, false);
        oxmlhttp.send(null);
    } catch(e) {
        return null;
    }
    return oxmlhttp.responseText;
}

So my question is, do you know of any faster/more efficient ways to get needed data? 
regards,
Bogdan

A:

Use the staticdir tool. See http://docs.cherrypy.org/dev/progguide/files/static.html#serving-files-through-the-staticdir-tool

