Skip to main content


Showing posts from April, 2010

Enterprise Library configuration without using App.config / Web.config

Sometimes you might want your Enterprise Library logging configuration file to kept separately and maybe you're not going to put an entry even in your web.config using [Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection].
The following codes shows how this can be accomplished:-

// Assuming the configuration file is default [loggingConfiguration] and in your current .exe directroyFileConfigurationSource fileSrc = new FileConfigurationSource("Test.config");// If you would like to validate your configuration // var loggingSection = fileSrc.GetSection("loggingConfiguration"); LogWriterFactory wfac = new LogWriterFactory(new FileConfigurationSource("Test.config")); var Writer = wfac.Create(); LogEntry logEntry = new LogEntry(); logEntry.Message = "Life"; Writer.Write(logEntry);
Your new configuration file is called Test.config and its contents the same…

.Net Performance notes

Some performance notes that i got from MSDN.
JIT compiler performs the following optimization given the small amount of time:
•Constant folding•Constant and copy propagation•Common subexpression elimination•Code motion of loop invariants•Dead store and dead code elimination•Register allocation•Method inlining•Loop unrolling (small loops with small bodies)

Value types, including integral types, floating point types, enums, and structs, typically live on the STACK. Reference types and boxed value types live in the HEAP. They are addressed by object references, which are simply machine pointers just like object pointers in C/C++.
NGEN, a tool which "ahead-of-time" compiles the CIL into native code assemblies
9 million allocation Type Size of Allocation Execution Time string 575,783 00:00:2739811int 8620 bytes - 40 instances 00:00:2515444short 10472 bytes - 238 instances 00:00:2538425employee 1,440,457,523 …