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

The Windows to Linux Comparison

The ASP to PHP Comparison

While these tests were carried out in a reasonably clean environment, no machines were available on which the test could be completely isolated. As a result, the test results show occasional fluctuations caused by other processes, briefly, competing for system resources.

ASP Results

ItemCountString LengthString TimeArray TimeBenefit %
20001025231.3130.01568,400%
40002083236.7810.03121,700%
600031412321.1560.03167,700%
800041992345.0310.032144,100%
1000052572672.8440.016466,200%
12000637526109.2660.031349,650%

The ASP test was not continued further, because the String processing took so long that the script times out. In fact it was necessary to split the test up in order to obtain all of these results. It was already clear at this stage that enormous processing time improvements are possible with this methodology. The difference is so large, that the array line appears as a horizontal line on the xaxis of the graph.

But what about PHP?

PHP Results

ItemCountString LengthString TimeArray TimeBenefit %
20001025230.0120.02448.15%
40002083230.0360.04973.16%
60003141230.0270.07436.38%
80004199230.0570.09261.76%
100005257260.0920.15659.33%
120006375260.2060.25580.73%
140007493260.3070.35586.59%
160008611260.4630.46399.98%
180009729260.6630.530125.02%
2000010847260.8030.625128.52%
2200011965260.9740.720135.25%
2400013083261.2090.933129.58%
2600014201261.4421.060136.06%
2800015319261.6771.202139.46%
3000016437261.9521.339145.77%
3200017555262.2571.525148.03%
3400018673262.5511.697150.33%
3600019791262.8651.856154.38%
3800020909263.2722.070158.06%
4000022027263.5952.273158.17%

The PHP test showed a somewhat different picture. At smaller sizes the additional overhead of using an array resulted in slower processing times, but as the volume increased the improvements started to appear. The difference in processing times under PHP was much less than under ASP. We must assume therefore that the internal string handling methods in PHP contain less performance inhibiting factors than those employed in ASP.

PHP actually shows a less impressive improvement than ASP test, but then the PHP test ran considerably faster than the ASP test. For most string sizes PHP was faster than ASP. Using the old method PHP is much much faster than ASP (which is effectively unusable). In either ASP or PHP, significant performance improvements are possible with this methodology. Despite PHP running faster, Windows might not be considered PHPs 'home' operating system. Which raises the next question.

How does PHP on Linux compare to PHP on Windows?

The PHP Method

The Windows to Linux Comparison