I’m not the most disciplined dev, dont know standards and am self-taught so bear with me. I create stuff very logically and fast but not always using ‘programming standards’.
I have a mobile app using geolocation API. it gets thousands of places from my db and makes gmaps v3 markers for the ones around the user’s current location.
there is an ajax call from my JS to an aspx page that calls the database, makes a json string, and sends the json string to the javascript that then creates the google map markers.
would i save time if the json string was in a flat file? im not sure if, generally speaking, accessing a sql db from an aspx page is faster than c# file i/o on a flat file with pre-rendered JSON.
EDIT: the bottle neck is in the JS not the server side code.
(of course, using the flat file, it would update everytime the db is updated)
function ajaxReturn(responseText) {
var JSONbizarray = (responseText.substring(responseText.indexOf('<span id="Label1">'), responseText.indexOf('</span>')).replace('<span id="Label1">', ''));
var JSONBizList = JSON.parse(JSONbizarray);
var list = document.getElementById('businessListContent');
list.innerHTML = "";
list.innerHTML += "<ul id=\"barListUL\" data-role=\"listview\" data-theme=\"d\" data-dividertheme=\"d\">";
for (var i = 0; i < JSONBizList.length; i++) {
var biz = JSONBizList[i];
list.innerHTML += "<li tabindex=\"0\" data-theme=\"d\" class=\"ui-btn ui-btn-icon-right ui-li ui-btn-hover-d\" role=\"option\">stuff using json object</li>";
}
list.innerHTML += "</ul>";
}
There is no other way to answer performance question except try and measure.
Stopwatch( http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx ) class will take care of measuring, and File.ReadAllLines ( http://msdn.microsoft.com/en-us/library/s2tte0y1.aspx ) will provide “read from file. In about 5 lines of code and you have your answer personalized for your DB/disk/servers/network.