This website uses cookies and similar technologies to understand visitors' experiences. By continuing to use this website, you accept our use of cookies and similar technologies,Terms of Use, and Privacy Policy.

Dec 02 2011 - 01:24 AM
The Performance Improvement on Vialogues
I've spent about a month working on the technique to improve the performance of Vialogues. Fortunately, big progress has been made. There are several techniques I'm using to decrease the running time of web application, and I will be pretty glad to share with all of you. 1. Efficiency improvement based on Python programming tip: There are quite a lot of blocks of code which is not written in the most efficient way. We can take advantage of the python built-in functions and technique to make it more efficient but not undermine the logic. For example, in plenty of cases, a list is defined by a "for loop" iteration to "append" new element in the end of loop, but you can rewrite it by means of "list comprehension" to decrease the running time. Even if it is inevitable to call "for loop", but it can be also improved on the efficiency if you are trying to avoid using of "dot": by making the simple definition such as "append=somelist.append", in the for loop, you don't need to call the reference of list to append the element in the end of list. In other word, you can use append(x) instead of somelist.append(x). 2.Optimization on the query language: Query is executed in a lot of places for selecting the needed result in database. It will also cost you a lot of time if you don't carefully write it, because the Vialogues database is pretty large, and it will keep being expanded in the future. For some important functions like "search" and "browse", query will be first executed to get the video or discussion list which is ready to be return as parameters of html template. Obvious performance improvement can be seen when you are implementing the query opimization on a huge database. The technique I mainly use is for table-joining and selecting distinct turple. 3. Reducing the connection with Amazon and utube Resource: A surprising truth is discovered that over 80% of running time is spent on linking the media resources which is for loading the pictures and videos on one page. The functions which cost large running time are normally using expensive "serializable" function to get videos and discussions' parameters. The function also cause the connection with resources module to get the media uri. However, not every result video requires the complete parameter group return. Most of the videos are not needed to get its icon and video uri. To solve this case, I tailor the serializable function to flexibly send the media parameters. After I finished these three points, it is very pleased to find the running time is decreased by 40% on average. For browse function, the running time is decreased from 1400ms to 700ms. Thank you Pranav and Yudan for giving me constructive suggestions!
Posted in: TechnologyWork Progress|By: Jing Luo|1501 Reads