In my opinion, there are several advantages on using JSON and render
it client-side
- Payload: JSON is way smaller than HTML. Specially important if you
are going to be browsed through a 3G connection.
- Server optimization: usually, the server can render JSON faster than
HTML (not in all cases,
What I usually look for in the Profile:
- Identify functions with biggest excl. time and try to optimize them
- Same for functions that are executed a lot of times
- Identify functions with a big difference between total time and
excl. time. It usually means that the function is doing something
I'll try two things:
a) Inspect the Profile output. There is a lot of information there.
Probably your answer is hidden somewhere in that info.
b) Try to disable big portions of the app to get more information on
the problem: is the whole system causing the problems? A specific
module? Try
If I have to choose, I prefer to use 'that' or something more
descriptive like 'originalThis'. But the best solution (IMHO) is to
write a bind function in Function.prototype that returns another
function with a fixed value for 'this'. For example:
Function.prototype.bind = function(obj) {
2011/2/3 Guillaume Andrieu gh...@taleo-initiative.org:
What should I recommend to new employees in my company when they have to
learn Javascript, who have to start coding with Javascript without having
had any proper formation ?
Why do you have people that needs to start coding JavaScript
When creating an API, I always try to be as friendly as possible to
the 'user' (the programmer using that API). So usually the best option
is to support as many type of arguments (object, separate values...)
as you can. Also, try to be permissive with the order. For example, if
you build a join()
I would add:
To set the prototype of an object, you modify the 'prototype' property
of its constructor function. To get access to the prototype you can
use myFunction.prototype or myInstance.__proto__.
//Constructor function
var myFunction = function() { /*...*/ }
myFunction.prototype.myProperty