Jump to content


Photo

Speed Up App Loading Time


  • Please log in to reply
10 replies to this topic

#1 Cjackson111

Cjackson111

    New Member

  • Members
  • Pip
  • 4 posts

Posted 23 February 2013 - 03:44 PM

Hello all. I have developed an iOS app (using PhoneGap, HTML5, CSS and JS). On the launch of the app it populates the local database from an XML file pulled from a server, which works fine. I am currently testing it on my device. Everything seems to work well except the pages that are accessing and displaying data load too slowly. I know it is difficult since I can not link to the actual app for anyone to see but I have included some of the code that I use below. I would love to get some insight as to how I can speed it up. It can take 10-15 seconds before the data is displayed. The page header graphic is shown but the rest of the page is blank until it loads.


***Index.html***

<div data-role="content">
<ul id="recent" data-role="listview" data-filter="true">
</ul>
</div>



***trnotesjsonxml.js***

(Pulls from XML file on the server and loads it into local database)
var db = window.openDatabase('trnotes', '1.0', 'Travel Notes',3*1024*1024);
db.transaction(function(t){
t.executeSql('DROP TABLE IF EXISTS notes');
// tx.executeSql('CREATE TABLE notes (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, address TEXT NOT NULL, option1 TEXT NOT NULL, option2 TEXT NOT NULL)');
t.executeSql('CREATE TABLE notes (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, category TEXT NOT NULL, description TEXT NOT NULL, image TEXT NOT NULL, restaurant TEXT NOT NULL, address TEXT NOT NULL, city TEXT NOT NULL, state TEXT NOT NULL, statelg TEXT NOT NULL, zip TEXT NOT NULL, phone TEXT NOT NULL, url TEXT NOT NULL, lat REAL, lng REAL)');

});


$.ajax({
type: "GET",
url: 'http://www.myserver.com/challenge.xml'
dataType: "xml",
success: parseXml
});




(Queries and displays the local data)
function getTitles() {
var list = $('#recent'),
items = [];
db.transaction(function(t) { //$.mobile.notesdb.transaction(function(t) {
t.executeSql('SELECT id, title, category FROM notes ORDER BY title ASC LIMIT ?', [trNotes.limit], function(t, result) {
var i,
len = result.rows.length,
row;
if (len > 0 ) {
for (i = 0; i < len; i += 1) {
row = result.rows.item(i);
items.push('<li><a href="#page3" data-trnote="' + row.id + '">' + '<strong>' + row.title + '</strong>' + '<br>' + row.category + '</a></li>');

}
list.html(items.join('\n'));
list.listview('refresh');
$('a', list).live('click', function(e) {
getItem($(this).attr('data-trnote'));
});
$('#entries').show();
} else {
$('#entries').hide();
}
})
});
}

#2 Cjackson111

Cjackson111

    New Member

  • Members
  • Pip
  • 4 posts

Posted 23 February 2013 - 03:46 PM

Sorry, forgot to mention that there are 430 records being saved from the XML file.

#3 Cjackson111

Cjackson111

    New Member

  • Members
  • Pip
  • 4 posts

Posted 25 February 2013 - 02:51 PM

What practices is everyone else doing to speed up their load time?

#4 Cjackson111

Cjackson111

    New Member

  • Members
  • Pip
  • 4 posts

Posted 25 February 2013 - 03:58 PM

As an alternative, is there a way to display a preloader on the page until the data is displayed? I just don't want the screen to be blank while it loads.

#5 Indianic

Indianic

    New Member

  • Members
  • Pip
  • 3 posts
  • Gender:Male
  • Location:India

Posted 09 March 2013 - 01:56 AM

Such a nice information. Thanks for sharing your experience about html 5.






Expert PHP programmers click here

Edited by Indianic, 09 March 2013 - 01:57 AM.


#6 Ania Maclain

Ania Maclain

    New Member

  • Members
  • Pip
  • 6 posts
  • Gender:Female
  • Location:Los Angeles
  • Interests:mobile apps design

Posted 01 April 2013 - 05:18 AM

Thanks for sharing this so nice one
The speed is depending on design of type dont put java script in in that is so nice for speed up to landing page...


Thanks and regards
Aania Maclain
http://www.pacificappdesign.com/
Ania Maclain from Los angeles working at http://www.pacificap....com/index.html

#7 Ania Maclain

Ania Maclain

    New Member

  • Members
  • Pip
  • 6 posts
  • Gender:Female
  • Location:Los Angeles
  • Interests:mobile apps design

Posted 01 April 2013 - 05:22 AM

Thanks for sharing this so nice one



Thanks and regards
Aania Maclain

Edited by Ania Maclain, 01 April 2013 - 05:23 AM.

Ania Maclain from Los angeles working at http://www.pacificap....com/index.html

#8 addlinksites

addlinksites

    New Member

  • Members
  • Pip
  • 3 posts

Posted 22 April 2013 - 01:39 AM

loading time is very important in seo perspective. Thanks for sharing
Addlinksites is directory where you can add link and share articles.
link directory | submit link

#9 addlinksites

addlinksites

    New Member

  • Members
  • Pip
  • 3 posts

Posted 22 April 2013 - 01:41 AM

loading time is very important in seo perspective. Thanks for sharing
Addlinksites is directory where you can add link and share articles.
link directory | submit link

#10 iqbal51

iqbal51

    New Member

  • Members
  • Pip
  • 4 posts

Posted 27 May 2013 - 03:43 AM

Loading time is very important for a website. But I don’t know how can I use your code.

#11 codrinsandu

codrinsandu

    New Member

  • Members
  • Pip
  • 3 posts
  • Gender:Male
  • Location:Romania

Posted 09 December 2013 - 04:22 AM

That's a good speed up test, I need a similiar app for my website jocuri cu Barbie, for mobile version to speed up, and loading easy pages.
I like <a href="http://www.jocuribarbie.pw" >jocuri barbie</a>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users