.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Trying to fulling understand P-Invoke for performance and best practices.

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :WPF

Hi, I'm looking to see if I'm approaching this subject correctly and how I can speed up performance/production.

I'm using a program that allows plug-ins. The plug-in is initialized through a Startup function we define in our plug-in dll. This startup function takes in an Interface* that can be used to communicate back to the program. I want to use C# for all my programming but have a thin managed/unmanaged wrapper that allows me to interface with the program. There are 2 parts...

1) The Program communicates through the plugin from static exported function calls... For this I'm just using global events so in each callback I call a C# event function if the C# plugin registerd to the event.


static void GetPlugInInfo(PlugInInfo* info)


  if (GlobalEvents::GetPlugInInfo != nullptr)


    ManagedPlugInInfo info;

    GlobalEvents::GetPlugInInfo(nullptr, info);

    // copy ManagedPlugInInfo -> passed in plug in info by copying each member variable

   // is this the fatest way to do this, is there a way I can just do a memcpy if my struct i

View Complete Post

More Related Resource Links

ASP.NET Best Practices for High Performance Applications

This article lists the techniques that you can use to maximize the performance of your ASP.NET applications. It provides common issues, design guidelines, and coding tips to build optimal and robust solutions.

Navigation/Performance - Best Practices


Hey all,

I was having a discussion with a coworker around sharepoints navigation, and was asked at what point does performance start taking a hit due to a large nav.  (Correct me if I'm wrong) but I know that SharePoint renders the navigation dynamically. So is it fair to say that if a site collection's global navigation has, say, 4 levels of flyouts, and tons of menu items that the site collection will in fact take a noticeable performance hit? Ignoring web design best practices where you wouldn't actually want your navigation to fly out 4 times...

Is there any sort of documentation or facts from MS regarding this sort of stuff? For example, although technically possible, only allow 3 flyouts and up to 'X' amount of menu items?

MethodInfo.Invoke performance



I'm using heavily reflection in our business code since we relay on database structures to manage workflows and validations. Methods that I'm invoking usually have known parameters and known return types. Invoke method is slow so I'm wondering does .NET 3.5 offers anything else that is faster. Most called methods are instance methods.

To further clarify my question: I read from my database an ordered sequence of methods that needs to be called. This methods have the same signature and they have to be called in order. This operation is executed many times when the user is active. Since we deploy our solution onto a terminal server every bit of a performance gain is at least 20-50 times multiplied.


Best Practices to Improve ASP.NET Web Application Performance

Performance tuning can be tricky. It's especially tough in Internet-related projects with lots of components running around, like HTML client, HTTP network, Web server, middle-tier components, database components, resource-management components, TCP/IP networks, and database servers. Performance tuning depends on a lot of parameters and sometimes, by changing a single parameter, performance can increase drastically. This Link lists out some tips for optimizing ASP.NET Web applications and many traps and pitfalls are discussed.

12 ASP.NET MVC Best Practices

And one of them was about what I consider to be ASP.NET MVC Best Practices. The presentation was in Italian so I decided to translate my slide in English so that everybody can read them.

Controller's best practices

Top .NET Performance Problems and how to avoid them

Every time I work with one of our .NET customers to help them with managing their application performance I come across the same problems as seen with other clients before: lots of ADO.NET queries, many hidden exceptions in core or 3rd party .NET libraries, slow 3rd party components, inefficient custom code

High-Performance .NET Application Development & Architecture

It has always been a goal of project architects to plan an effective strategy from the ground up in regards to an new application. All relevant factors are taken into consideration with respect to the application, from its design and layout to a functional website infrastructure. Pre-.NET strategies and design guidelines still effective now were developed with Microsoft's DNA (Distributed interNet Application) platform. This model successfully served the purpose of architecting N(any number of)-Tier (levels) applications. In its basic sense, as in most robust, distributed applications, you'll architect 3 main layers or Tiers: presentation, business rules and data access.

How to improve the performance of ASP.NET MVC web applications

It is an in depth analysis of a Digg-like site and how it went from serving (on a test machine) 6 req/sec to 390 req/sec.

The biggest gain, 74 req/sec to 390 req/sec happened when he introduced data caching and another 25 req/sec where gained when he introduced the compilation of LINQ queries.

High Performance ASP.NET - Speeding Up ASP.NET Pages

have been writing a series of blog posts, which I have named High Performance ASP.NET Websites Made Easy! There is no rhyme or reason to the order of these posts and certainly can be read in any order:

Developing High Performance and Scalable ASP.NET Websites
Avoid Chatty Interfaces Between the Tiers in Your ASP.NET Web Application
ASP.NET Page Profiling - Page Tracing - High Performance and Scalable ASP.NET Websites Made Easy
Web Applications: N-Tier vs. N-Layer - Benefits and Trade-Offs
Query Analyzer - Sql Server Database Indexes and Execution Plans

Improving Application Performance in .Net

Application performance has always been a concern for Web Application developers. This article contains guidelines and tips for maximizing application performance in ASP.NET.

Tips to Improve Your ASP.NET Web site performance

ASP.NET has been developed with lots of features which makes developer life easy. Start from ViewState, PostBack, Server Controls , User Controls and etc. All of them can make your web development experience fun and easy, but improper use of them can cause your site performance slowdown. Most of the controls generate overhead to the client and server. Therefore in this article, I I will list out about things you can do and don't to improve your ASP.NET website performance.

10 Tips for Writing High-Performance Web Applications

Writing a Web application with ASP.NET is unbelievably easy. So easy, many developers don't take the time to structure their applications for great performance. In this article, I'm going to present 10 tips for writing high-performance Web apps. I'm not limiting my comments to ASP.NET applications because they are just one subset of Web applications. This article won't be the definitive guide for performance-tuning Web applications-an entire book could easily be devoted to that. Instead, think of this as a good place to start.

Performance Tests: Precise Run Time Measurements with System.Diagnostics.Stopwatch

Everybody who does performance optimization stumbles sooner or later over the Stopwatch class in the System.Diagnostics namespace. And everybody has noticed that the measurements of the same function on the same computer can differ 25% -30% in run time. This article shows how single threaded test programs must be designed to get an accuracy of 0.1% - 0.2% out of the Stopwatch class. With this accuracy, algorithms can be tested and compared.

Best Coding Techniques To Improve Performance for SharePoint Applications

As more developers write custom code by using the SharePoint Object Model, they encounter common issues that can affect application performance.

The following areas reflect the main issues encountered by developers as they write custom code by using the SharePoint object model:

§ Disposing of SharePoint objects

§ Caching data and objects

§ Writing code that is scalable

LINQ to SQL Performance Considerations

As developers we have a wide array of tools at our disposal. One of the most time consuming, but most beneficial tasks we must undertake is to determine which of those tools to use for a given situation.

Performance tuning tips for database developers

Performance tuning is not easy and there aren't any silver bullets, but you can go a surprisingly long way with a few basic guidelines.

In theory, performance tuning is done by a DBA. But in practice, the DBA is not going to have time to scrutinize every change made to a stored procedure. Learning to do basic tuning might save you from reworking code late in the game.

Below is my list of the top 15 things I believe developers should do as a matter of course to tune performance when coding. These are the low hanging fruit of SQL Server performance - they are easy to do and often have a substantial impact. Doing these won't guarantee lightening fast performance, but it won't be slow either.

SQL Server Performance

Improving .NET Application Performance and Scalability
SQL: Scale Up vs. Scale Out
Stored Procedures
Execution Plans
Deployment Considerations
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend