Little River Software
Home -> Articles -> String Vs Array
Little River Software - Custom PHP Software Design and Programming
Introduction

The String Size Problem
This is the first chapter

Introduction

String Vs Array

As programmers we often have to handle long strings of data. Sometimes handing long strings is a result of poor design, and can be avoided with a better design, but sometimes long strings are simply unavoidable. When should we use a string, and when should we look for an alternative.

The question arose for us when working on a web server based application written in ASP/VB. The application was large, and in all the modules we had completed, we had not had serious performance concerns related to either ASP or VB. But the development of a new module, required the processing a large number of large text files. The performance seemed to be excellent initially (using a few small test documents), but it became unusably slow when large 'real documents' were used for testing. One expects a longer processing time when processing bigger volumes of raw data, but as the data got bigger the performance fell off faster than expected. Had we made a design mistake? What could be done to improve the performance? Were these barriers intrinsic to the environment, and therefore insurmountable? The performance problems were severe, so we had to find a solution.

Initially this test project was simply a comparison of strings vs arrays. The final test was required to guide us to a real world solution, and as such was expanded to compare the performance of:

  • Processing long strings vs processing arrays of shorter strings.
  • ASP vs PHP.
  • Windows VS Linux.

The source Code for this article is avaliable in the Downloads section of this site.

Introduction

The String Size Problem
This is the first chapter