How I optimized HTML Renderer and fell in love with VS Profiler

Managed HTML rendering is a pain in the ass for a really long time, a really good solution I was able to find is this HTML Renderer hosted on CodePlex, though the project seems to be dead and I'm not sure how I can contribute… Anyway, It's 100% managed code and has nice HTML 4 and CSS level 2 spec cover.
So I decided to check it out and after a little playing around it felt a bit heavy so I decided to look into its performance using built in visual studio profiler, to ruin the ending I have managed to reduce average render time from 282 msec to 24 msec (91%).
The final code with most of the issues fixes raised here and here can be found here, you can use it under the same license the original code is under. Also, if everything goes well, I might be adding features to the project including text selecting for copy-paste support.
Continue reading

Anonymous methods under the hood

To continue my previous post on a bug I encountered. This time anonymous methods.
The best way to learn what happens under the hood is to see the generated code, I like to use dotPeek as it has the same UX as Resharper.
Not to make this post super long I focus only on 3 examples and ignoring different scenarios (statics, delegates) as the result is not much different and not really interesting.
Continue reading

When does RCW reference count is incremented?

I recently encountered a fun bug in Outlook addin I'm working on and it was interesting enough that I decided to create a few posts around what caused it, it will probably be 3 blogs starting with RCW reference count stuff, continuing with anonymous delegates and finishing the the bug itself.
Disclaimer: this post is based on a similar stackoverflow question I answered a while ago.
Continue reading

My first post

This is my first blog, so let me introduce myself. My name is Arthur Teplitzki and I am currently a software developer at Jive Software. I'm part of a very small team working on developing an Outlook Add-in.
The reason I decided to start a blog is that sometimes I run into problems, problems that turns to be hard problems, problems that take me a lot of time to solve. All because I didn't find anyone else out there that faced the same problem and wrote about it. So I decided to help the next guy, if some poor fellow will find my blog and it will save him some headache, I will be a happy blogger.
I don't work on infrastructure, framework or cutting edge crap so my posts will be down to earth dev problems I encounter. And because I love to dig deep to know the soft underbelly of the problem I can write something interesting about it. That said I don't always find the best solution or the source of the problem, I'm just human, so always read it with a grain of salt.