.NET 4.0 Memory Mapped Files Performance

Viewed 6994

I'd like to know if anyone tried new .NET 4.0 Memory Mapped Files features? I know that they are as old as OS but native handling in .NET is new.

Has anyone been able to test this and say something about performance? I'm quite interested in access time to random parts of binary file, write speed and so on. Also performance comparsion to native WinAPI MMF would be nice.

Thanks!

3 Answers

Memory mapped files in .NET 4.0 (in the new System.IO.MemoryMappedFiles namespace) simply wrap the Win32 API for memory mapped files.

That means they are as fast as is possible. This is the same mechanism that is used to load .NET assemblies into memory.

In terms of actual timing numbers, this will depend on 32bit versus 64bit, how much memory you have, how large the files are, the access pattern(s) and to a large extent the type of physical disk hardware.

Ref: Memory-Mapped Files

Related