I have this code I am using in a private project. The following is a snippet of code I use to retrieve and load playlists from YouTube:
for (feedEntry in a.feed.entry) {
if (a.feed.entry.hasOwnProperty(feedEntry)) {
feedTitle = a.feed.entry[feedEntry].title.$t.replace('] - ', ']').replace(' : ', '').replace(/\(.*?\)/g, "").replace(/\[.*?\]/g, "");
feedURL = a.feed.entry[feedEntry].link[1].href;
fragments = feedURL.split("/");
videoID = fragments[fragments.length - 2];
url = videoURL + videoID;
var c = feedTitle.split(' - ');
tracklist.push({
'title': c[1],
'artist': c[0],
'url': 'http://youtubeinmp3.com/fetch/?video=http://www.youtube.com/watch?v=' + videoID + '',
'album': 'YouTube'
})
}
This code, understandably, causes the browser to freeze a few seconds when loading larger playlists.
What ways could I go about optimizing this?