Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB4,VB5,VB6
Expertise: Intermediate
Apr 20, 1999

Fixed-length strings allocate and deallocate faster

Fixed-length strings are generally slower than conventional strings, because all VB string functions and operators only recognize conventional strings, thus all fixed-length strings must be transparently converted to and from conventional strings.

However, arrays of fixed-length strings occupy a contiguous area of memory, therefore they can be allocated and released much faster than arrays of conventional strings. For instance, an array of 100,000 fixed-length strings of 30 characters each is allocated in about half a second (on a Pentium 233MHz machine), whereas it takes more than 8 seconds to initialize the same amount of variable-length strings with 30 blanks. The latter array can be erased in about 0.35 seconds, but the array of fixed-length strings is deallocated instantaneously. If your application deals with such huge string arrays, consider the convenience of using fixed-length strings to optimize the allocation and release phase.

Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date