Increase Sales & Maximize Your Budget

The most important job of any software protection tool is to increase profits with the smallest possible cost. The DeployLX Software Protection System is designed to increase your sales with sensible pricing options to maximize your budget.

Tell me more about Economics

Optimize trial conversions
Single deliverable, multiple product editions
Respond to customer needs
Reduce piracy and EULA violations
Lower your Total Cost of Ownership
Tools and support priced to fit your budget
Tell me how XHEO can help my company increase sales and maximize our budget.

Easy, fast thread-safe dictionary with a Type key [Jun 04, 2009]

From time to time I'll want to perform some operation on a subset of properties of a Type. However reflecting over types can be costly exercise. Since Types don't change at runtime the natural solution is to parse them once and cache the results. For small sets this works well. However  with hundreds of types, the performance starts to degrade. I've also noticed that the typeof operator is rather slow when compared to intrinsic is and as operators.

So to create a fast Type keyed dictionary I use the C# compiler and runtime JIT to do it for me. This solution is extremely fast and due to it's static nature, thread safe. But, it's also lazy-init because generic types aren't created until they're actually used at runtime.

public static class TypeCache<T>
{
	public static readonly Type Type = typeof( T );
	public static readonly PropertyInfo[] Properties = 
			typeof( T ).GetProperties();
}

I can now get all the properties of a type like this:

foreach( var p in TypeCache<Entity>.Properties )
{
	Console.WriteLine( p.Name );
}

Since this is all actually part of the runtime types, the JIT and compiler can take advantage of any available optimizations. Analysis of the actual code JITted at at runtime shows the lookup TypeCache<Entity> actually indexes into a runtime table, whereas the typeof operator does an actual lookup by signature.

Limitations

  • It's ready only. It's a great lazily initialized structure but the factors that make it thread safe.
  • It's never garbage collected. Type information is always retained in the AppDomain so any statics created this way will always remain live.

 
 

Start protecting your investment. Download the evaluation now.

Licensing 3.x: Copy protection and licensing tools for .NET Windows Applications, Services, ASP.NET Applications, Controls and Components.          CodeVeil 3.x: Absolute security for your Intellectual Property. Assembly encryption, obfuscation, runtime protection & hacker-thwarting barriers.

More Info    Pricing

More Info    Pricing

 
KillSwitch 3.x: Add contract compliance to your custom projects. It's quick. It's easy. It's free.

More Info    Download

Rapid Integration Service: Let XHEO help you meet your project deadlines by providing expert integration services.

More Info

Products : News : Store : Search : Contact : About XHEO : Site Map
Copyright © 2002-2009 XHEO INC. All Rights Reserved.


Copyright © 2002-2009 XHEO INC. All Rights Reserved.