Barand Posted October 14, 2019 Share Posted October 14, 2019 (edited) Around the turn of the century I had just discovered PHP and was currently using ASP with VB for intranet applications. One particular page enabled users to view log entries each day. This had worked fine for months when I received a complaint from one of the users that it was running very slowly. I tried it myself and, sure enough, it took about 15 seconds to display the data. Examining the entries in the SQL Server table for that day I noticed that there were some abnormally long text entries, way longer than usual. Curious about the time taken I decided to write the application in PHP (for the practice if nothing else) and see if that improved things. It did. For the same day, the screen displayed in 0.25 seconds. That was 70 times faster! Too good to be true, I thought. So I compared the two programs. The structure of the ASP program was loop get record concatenate output into a string endloop outout the string The PHP structure was loop get record output endloop The ASP structure was a better "separation of concerns" which is the method usually preached, but it did come at a cost as further experimentation was to prove. My next task was to rewrite the ASP using the PHP structure and vice versa so that I could get a much fairer comparison. As the chart below shows, concatenating does have an overhead (especially with long strings) and this is even more marked with VB which seemed extremely poor at handling the task. Edited October 14, 2019 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/309372-separation-of-concerns-at-a-cost/ Share on other sites More sharing options...
requinix Posted October 14, 2019 Share Posted October 14, 2019 I really wouldn't have expected ASP Classic to be that bad at handling strings - I mean sure, strings are immutable, but reallocating that much bringing a 10x decrease in performance? While I was looking up whether it has some equivalent to StringBuilder (it doesn't) I found this that you might find interesting. Quote Link to comment https://forums.phpfreaks.com/topic/309372-separation-of-concerns-at-a-cost/#findComment-1570652 Share on other sites More sharing options...
Barand Posted October 14, 2019 Author Share Posted October 14, 2019 1 hour ago, requinix said: I really wouldn't have expected ASP Classic to be that bad at handling strings Bad enough that someone felt the need to publish an article about it! Quote Link to comment https://forums.phpfreaks.com/topic/309372-separation-of-concerns-at-a-cost/#findComment-1570659 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.