HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...DNN Core Development Policy SuggestionDNN Core Development Policy Suggestion
Previous
 
Next
New Post
12/20/2007 11:17 AM
 

In my experience, string concatenation is often the biggest offender when application performance slows.  While DNN is indeed pretty quick, and appears to be quite scalable, I would like to suggest something to the Core Team, and all Project Team members.

There are test results all over the Internet showing that concatenating strings is best done either using StringBuilder, or String.Concat versus the popular method of simply using a "&" or "+".  Case in point, I took a web service that was responding to requests from a response time of 60-90 seconds to 2-5 seconds just by switching the string concatenation throughout the web service (and on some occasions, caching the strings).

I am sure that the Core Team already has some sort of guideline in place for contributing developers.  I would like to suggest that the Core Team have its contributors to use the StringBuilder and String.Concat methods whenever a string is to be concatenated. 

This may seem like a trivial thing to some of you out there, but consider the memory and processor consumption for a string object like this:

Dim strFirstName As String = "John"
Dim strLastName As String = "Dough"
Dim strName As String = String.Empty 
strName = strFirstName & " " & strLastName ' COMMON METHOD
strName = String.Concat(strFirstName, " ", strLastName) ' FASTER METHOD

While if this is called every once in a while, there will not be a noticeable difference to a single user.  However, if this string concatenation method is called many times per page, per module, and per provider for every page request, this adds up to significant resource consumption.  Not only in terms of processor time, and memory usage, but also consider the additional energy required by the servers that are serving up these pages.   For a busy web site or web server, there could be a significant reduction in compilation, rendering, and response time if better string concatenation practices were encouraged. 

(Remember, better "string concatenation practices" does not mean to use StringBuilder for every concatenation scenario, only when it offsets the speed and efficiency problems when scaling for performance overall on an application.  My main point is to never use the "&" or "+" methods.)

I just hope that this post at least strikes up some dialog to get the ball rolling on this.  I look forward to any comments and conversation on this topic.

Here are some easy to find resources related to this topic:


These are my personal opinions and don't necessarily represent the views and opinions of DotNetNuke Corporation.
Will Strohl
Media Module Team Lead, User Groups Team Lead
Sales Engineer, DotNetNuke Corporation

DotNetNuke Blog | Find a DNN User Group | Media Module
Twitter: @WillStrohl LinkedIn: Will Strohl on LinkedIn

 
New Post
12/20/2007 11:43 AM
 

Will this is a great recommendation.  I know I personally have been guilty of this when in a hurry, and I have gone back and most of the time fixed the issues and noticed dramatic improvements in performance.

I think little optimizations like these are items that can go a long way.


-Mitchel Sellers
Microsoft C# MVP, MCITP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Consulting Quotes, and DNN Technical Support Services

I recommend PowerDNN and 3Essentials for DotNetNuke Hosting and BaseCamp for project management
 
New Post
12/21/2007 4:25 AM
 

I honestly thought that this thread would strike a vein in people similar to the DIV vs. TABLE topic.  I was very disappointed this morning to see that you are the only person to reply.  :(

I guess that there are not that many people that care either way?  I don't consider myself an "expert", but the potential performance benefits are unmistakeable.  And consider this...   With being "green" becoming mainstream, if DNN were to overhaul its string concatenation and everyone upgraded their instances of DNN, imagine the energy savings across the globe...  (It would make a great press release.  Wink-wink!)


These are my personal opinions and don't necessarily represent the views and opinions of DotNetNuke Corporation.
Will Strohl
Media Module Team Lead, User Groups Team Lead
Sales Engineer, DotNetNuke Corporation

DotNetNuke Blog | Find a DNN User Group | Media Module
Twitter: @WillStrohl LinkedIn: Will Strohl on LinkedIn

 
New Post
12/21/2007 4:58 AM
 

 

I honestly thought that this thread would strike a vein in people similar to the DIV vs. TABLE topic.  I was very disappointed this morning to see that you are the only person to reply.  :(

It's not that contested of a subject because:

a. It's undeniably true

b. Many developers may not know about the options available with concatenation.

c. The battle between tables vs. divs is really a programmer vs. designer argument.

It makes sense that the core should go through and clean up any & and +, especially in any loops, or client side data objects (repeaters, datalists etc).

 


Erik Hinds
Risdall Marketing Group
#1 Web Design Agency in the World

www.risdall.com | www.risdall.net | erik AT risdall DOT-COM

 
New Post
12/21/2007 5:33 AM
 

Okay...  "tables vs. divs" was a poor example.  :)


These are my personal opinions and don't necessarily represent the views and opinions of DotNetNuke Corporation.
Will Strohl
Media Module Team Lead, User Groups Team Lead
Sales Engineer, DotNetNuke Corporation

DotNetNuke Blog | Find a DNN User Group | Media Module
Twitter: @WillStrohl LinkedIn: Will Strohl on LinkedIn

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...DNN Core Development Policy SuggestionDNN Core Development Policy Suggestion


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

Attend A Webinar
Free Demo Site
Download DotNetNuke Professional Edition Trial
Have Someone Contact Me
Have Someone Contact Me
DotNetNuke Store

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

PowerDNN
r2integrated
Telerik JustCode Free

DotNetNuke Scoop!

Sponsors

DotNetNuke Corporation

DotNetNuke Corp. is the steward of the DotNetNuke open source project, the most widely adopted Web Content Management Platform for building web sites and web applications on Microsoft. Organizations use DotNetNuke to quickly develop and deploy interactive and dynamic web sites, intranets, extranets and web applications. The DotNetNuke platform is available in a free Community and subscription-based Professional and Enterprise Editions with an Elite Support option. DotNetNuke Corp. also operates the DotNetNuke Store where users purchase third party apps for the platform.