I'm currently developing a rather large analytic program with a Django/Python backend and am using jQuery.
Let's say that all of my statistics are based on the concept of a "Person
". After viewing overview statistics, someone may want to open up an individual Person
and look at their statistics.
Currently I send an AJAX request back to my server, Django fetches the person, renders an entire DOM Tree for them, and returns it. jQuery takes the returned <div>
and adds it to the documents DOM tree along side any other opened people.
So every Person
has their own div with all of the same elements, just with their information. The current person you're viewing is display:block;
while I display:none;
any other people. Any elements (such as a button to view more detailed information) that need to go back to the server to fetch more detailed information are coded with Django's templating system and given an onlick of something like getMoreInformation('myUUID');
. I would also like to note that I find myself using UUID's in element IDs frequently so AJAX can find and modify the right person's information if need be.
I recently discovered Knockout.js and am wondering if it would be better for me to use it in this situation, and have some concerns about speed, etc.
It seems like Knockout.js would be "the right thing to do" as it provides a better 1-to-1 relationship between data on the backend and how it is represented in the Javascript (models to models) instead of individual DOM elements with ids passed for any functions. Not to mention it would drastically reduce the amount of elements in the DOM tree.
However, my primary audience is IE8, and I have concerns on Knockout.js having performance problems. While currently I just hide and show the divs related to the people you're investigating, Knockout.js would have to go through all of the data-bind
's and use Javascript to replace their content.
What are the performance concerns for using Knockout.js in a situation like this? Or would they be so minimal as to not matter? Hard a hard time finding any benchmarks, has anyone experienced slower UI when moving to Knockout.js? (Less DOM Elements + Knockout.js vs. More DOM Elements w/o Knockout.js in a "real world" application is kind of what I'm looking for here.)