Encode html without creating html elements (version: 0)
There are two way of encoding html elements. One is the create an html element and let the browser handle it. The second looks at every character passed in and then runs a regex match on it and replaces the chars with &#CHAR_CODE;.
Comparing performance of: EncodeByCreatingElement vs EncodeUsingRegex
Memory measurements supported only in Chrome.
For precise memory measurements Chrome must be launched with --enable-precise-memory-info flag.
More information: Monitoring JavaScript Memory