Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Potential Code optimization for stationsList.js file #41

Open
amobi opened this issue Sep 7, 2012 · 1 comment
Open

Potential Code optimization for stationsList.js file #41

amobi opened this issue Sep 7, 2012 · 1 comment

Comments

@amobi
Copy link

amobi commented Sep 7, 2012

I realize that this is not really a big issue, but by factoring out the repetitive SQL insert statements in the Weather stationsList.js files, this file size could be cut down by approximately 50% i believe. For example:

var stationsList = ["insert into StationList (latitude, longitude, xml_url) values (-22.017, 166.217, 'NWWW');",
"insert into StationList (latitude, longitude, xml_url) values (-21.233, -175.15, 'NFTF');",
........
];

By removing the continuously repeated string in the statement, you can then place it once in the following block:

for (var i=0; i<arrLength; i++) {
tx.executeSql('insert into StationList (latitude, longitude, xml_url) values ('+stationsList[i]+');', null, incrementPercent);
}

The result would be a much smaller file size. As I previously mentioned, this may not be of much importance but it does cut down file size which in my opinion is always a good thing!

@astanley
Copy link

astanley commented Sep 7, 2012

Great suggestion! I agree - if you can reduce the size of resources without impacting the quality/function of an app - its a win win for everyone.

I've been wanting to see that sample refactored & improved to better support PlayBook & BB10. Your tip should be considered when that work happens (no ETA).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants