When you are developing an application there is a time when performance comes to play. This can be either in the beginning of the project due to certain requirements or after some time developing you’ll notice your application does not performance as well as you thought it would. This post will give you a few tips on how you can increase performance without having to rewrite a great deal of your code.
Because I learn new things myself every project I will update the blog once in a while to reflect the newest findings
Retrieve data from the current component within a event handler:
This is a very easy one but will eventually lead to a bit more performance. Whenever you want to retrieve data from the current component within a SSJS event handler you should retrieve it directly using the following line:
this.getParent().getValue();
The ‘this’ is a pointer to the current eventhandler. And as you can see this event handler does have a parent property. This parent property is a pointer to the current component where this eventhandler is bound to. It will be faster then
getComponent("componentname").getValue();
It will be faster because the getComponent() method has to ‘search’ for the component you are looking for where the getParent() method is a pointer to the component directly.