Remove whitespace from your ASP.NET page(madskristensen.dk)

submitted by madskristensenmadskristensen(8565) 6 years ago

In a normal webpage there is a lot of whitespace. We put it there in form of tabs and carriage-returns in order to make the document more maintainable and easier to read. But it has its price in terms of adding to the overall weight of the document in kilobytes and it takes longer for the browser to render a page with a lot of whitespace. This is especially true for IE6, which renders whitespace a lot slower than its counterparts.

2 comments |category: |Views: 122

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by gavinjoycegavinjoyce(25.7k) 6 years ago 0

Hi.

As .NET strings are immutable, the current solution will result in bad performance; the StringBuilder would be advisable.

Reply

posted by madskristensenmadskristensen(8565) 6 years ago 0

I don't think a StringBuilder would bring any performance boost here. I concidered using it, but it is only efficient when doing many (more than 5) concatinations and that's not the case here. However, the method uses regex and the replace function, and maybe the StringBuilder handles them better than a string would. I simple test could give us the answer.

Reply

information Login or create an account to comment on this story