Posts

Showing posts from April, 2010

Compiling mono on Fedora 12.

It is really easy, just following the instruction from here and set the prefix to your preferred build directory; For example, set the mono binaries to /tmp/mono_build. ./configure --prefix=/tmp/mono_build; make; make install That's it.

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 directroy FileConfigurationSource 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 ca...

.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:2739811 int 8620 bytes - 40 instances 00:00:2515444 short 10472 bytes - 238 instances 00:00:2538425 employee 1,440,457,523 ...