After you have your Facebook application developed, your next step is to see what areas of the app can be optimized to speed up overall performance.
Here are several suggestions to consider when looking to speed up your application:
-
Reduce the total number of server calls that you need to make from your application by using FQL queries over standard Facebook API calls.
-
When you need to make several API calls at one time, use the
batch.run
method to combine up to 20 calls into a single request to the Facebook server. -
Use FBML canvas pages rather than iframe pages. According to Facebook, FBML pages are faster.
-
Move JavaScript and CSS code to external files and then import them into your pages. Facebook caches these files the first time they are accessed and stores them indefinitely.
-
Use the
fb:ref
element to store FBML content, particularly when you need to publish to multiple profile boxes. Facebook cachesfb:ref
references, making them quickly accessible on future usage. -
Most Facebook applications call
friends.get
at some point during their operation, consider making this call during your initial app load to minimize server requests. -
As in any Web application, keep your canvas pages manageable in length. If you are displaying multiple rows of data, divide your content over a series of pages. Consider, for example, how the Photos app handles this when viewing an album.
-
Use AJAX when refreshing page content, limiting the page refresh to part of a page rather than the entire page.
There have been no comments | Subscribe to Comments | Jump to Form »