title: Fastest way to get data from server up to Javascript
body: <p>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. </p>
  
  <p>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.</p>
  
  <p>The approach so far is to have a server-side exposed cherrypy method:</p>
  
  <pre><code>@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)
  </code></pre>
  
  <p>This just gets the actual file on the disk and returns the data from the file. And in the client side:</p>
  
  <pre><code>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;
  }
  </code></pre>
  
  <p>So my question is, do you know of any faster/more efficient ways to get needed data? </p>
  
  <p>regards,
  Bogdan</p>