Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Ask Reuben 37 - Large Strings  (Read 5420 times)
Reuben B.
Four Js
Posts: 1116


« on: July 09, 2020, 02:13:25 am »

In the previous Ask Reuben article I discussed how STRING should be preferred over the use of CHAR variables of some arbitrary length and one of the reasons given was performance.  This performance advantage is most noticeable when manipulating large strings. 

Any time you are constructing a large string you should consider using the base.StringBuffer class and its append method as it makes the most of passing by reference.   

How can you verify this gain?   What you can do is create a little test program that has different functions using the various data types and techniques available to construct a large string, and then use the “profiler" to measure what percentage time is spent in each function.  You can then infer that the test function that has the least amount of percentage time spent in it has the datatypes and techniques with the best performance.

This article has such a test program and shows how to interpret the test results and conclude that base.StringBuffer and the append method has the best performance when constructing a large string.

Read more at https://4js.com/ask-reuben/ig-37/

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines