Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Now I realize this is a kind of weird question but here it is: Let us assume I r

ID: 645927 • Letter: N

Question

Now I realize this is a kind of weird question but here it is: Let us assume I redraw all the controls by myself rather than using the default provided ones (Obviously I'm talking of winforms as WPF is already a custom drawn control set and winforms are just a way to access the Win32 API). Now I make an application with my custom-drawn controls. Then I make an application with winforms, which, in turn, uses the Win32 API. Now, when I run both the applications, will there be any performance difference? If yes, which will perform better?

Now comes the main question: How (and based on what factor(s)) do you decide / predict as to which will perform better?

P.S. Forgive me if I am not clear enough. I always have trouble expressing my thoughts.

Explanation / Answer

Remember that .NET Framework BCL code is optimized for being useful to the largest number of programmers, not for good performance in your particular application. So it's highly likely that you can beat the performance of any particular piece of it, even if you aren't a Rico Mariani.

However, you should learn from those experts, in particular mantras like "Measure, Measure, Measure". This doesn't mean you have to build and debug your version completely before figuring out whether you can beat the BCL. It does mean you identify which portions of the library code are causing you performance issues, so you don't waste effort re-inventing what doesn't matter.

Once you know how good or bad the performance of the general-purpose code is, you stand a good chance of predicting whether you'll be able to beat it. Especially if you run some scalability tests. There are lots of framework-provided widgets where simple operations like adding multiple listbox items1 have quadratic (or worse) complexity... simply because the largest number of applications never put more than two dozen items in the control anyway. Armed with an estimate of the standard widget's runtime (and memory) complexity for the operations you need, you'll know exactly where you have the opportunity to do better in a way that pays dividends on your effort.

1 Sometimes the documentation points these out and even provides a way to plug in optimized-for-the-application code without throwing away the whole library component. For example, ListView "virtual mode", or "Owner-Draw" for the tradition Win32 controls.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote