So, I continue to try to come up with diagrams and information to help new SharePoint developers wrap their heads around this SharePoint beast, especially when those newer to development are on my team. To that end, I drew up the below diagram to help some of our junior devs understand where/when code is being executed in SharePoint at a high level. Note that I say “High Level”… This is a simplistic diagram that can get a LOT more complicated if you want to dive in deeper. For my lesson it served its purpose well. So, please no comments from the peanut gallery about information 3 levels down that’s missing unless it adds to the discussion. Thanks
So, the diagram below details where code is executed on a page load and gives the basic flow of the page load. There are actually many more steps, but again, we are staying high level here. I just know someone is still going to say something like “Well.. actually… the dlls are getting executed when…” Anyway, here’s the diagram with some information I like to point out:
Code Scope / Where it is executed
I actually get this question a lot. Since XSL is executed on the server less data is getting passed over the wire and a beefier machine (hopefully) is doing the processing. The outcome of course is better performance. When You are using jQuery and making Web Service calls you are building XML strings and sending them to the server. Then ALL the results come back and the client machine has to parse through the XML and use what it needs and ignore the rest (and there is a lot of garbage that comes back from SharePoint Web Service calls).
Marc Anderson made the excellent point that this is not always true. I was thinking along the lines of retrieving lots of data for a list and building a DataViewWebPart with it instead of doing the same thing in jQuery by calling SPServices to return hundreds of rows of data and building a fancy report out of it. You CAN get better performance using jQuery in the some situations because you can delay calls for data until you need it, limit data you want to retrieve with CAML and user input, and not execute a web service call if it’s not needed. Marc’s quote was “Good architecture is good architecture”… wise words…
So.. let’s say it another way… You can get better performance with jQuery over XSL if you can take advantage of the following:
- Delay execution of code to retrieve data until it is needed
- Avoid calling a method to retrieve data entirely
- Lesson the amount of data retrieved by user selection and CAML
Thanks again for the input Marc.
So, what does this all mean?
As always, thanks for stopping by, hope you learned something new.