Sunday, 12 February 2012

The Very Concurrent Garbage Collector

The F#.NET Journal just published an article about performance:

"One of the most interesting research papers on garbage collection describes an unusual algorithm called the "Very Concurrent Garbage Collector" (VCGC) that manages to recycle unreachable heap blocks with only the occasional global synchronization with mutator threads in order to snapshot the global roots. This article walks through the design and implementation of VCGC in F#. Given that the subject of concurrent garbage collectors is notoriously difficult, this demonstrates how prototype solutions written in high-level languages like F# can help with correctness. Furthermore, the implementation adopts an allocationless programming style in order to leverage the benefits of this GC algorithm and we find that maximum pause times are over 100x shorter than with the default .NET 4 workstation GC and wall-clock performance is only slightly worse..."


To read this article and more, subscribe to The F#.NET Journal today!

Prototyping a mark-sweep garbage collector

The F#.NET Journal just published an article about garbage collection:

"Garbage collectors can be notoriously difficult to write. Consequently, the availability of a working simulation can help greatly when trying to write a production-quality garbage collector. This article walks through the design and implementation of a prototype mark-sweep garbage collector. This not only demonstrates that it is possible to prototype low-level tools in F# but also serves as an educational example about garbage collection itself..."


To read this article and more, subscribe to The F#.NET Journal today!

Sunday, 8 January 2012

Fast Generic Pretty Printing

The F#.NET Journal just published an article about performance:

"The ability to convert values into legible strings efficiently, a process known as generic pretty printing, has a variety of uses including debugging and serialization. This article takes a look at the characteristics of the built-in pretty printer before considering alternatives including combinators and reflectors with a view to improving performance. Ultimately, a generic solution is proposed that runs 7,600× faster than the built-in F# solution on our test case..."


To read this article and more, subscribe to The F#.NET Journal today!

Saturday, 17 December 2011

Rendering autostereograms

The F#.NET Journal just published an article about graphics:

"An autostereogram is a tiling distorted such that the differences between one column of tiles and the next simulate the differences between images seen by the left and right eyes when viewing a 3D scene. This allows a practiced viewer to stare through the picture such that their eyes view the stereogram offset by a single column of tiles and, therefore, they perceive the image to be 3D. This article describes a simple technique that allows autostereograms to be generated by a parallelized F# program..."


To read this article and more, subscribe to The F#.NET Journal today!

Sunday, 11 December 2011

Metaprogramming: parsing with active patterns

The F#.NET Journal just published an article about metaprogramming:

"Metaprogramming is the art of writing programs that manipulate other programs and includes writing compilers and interpreters as well as more exotic tools such as theorem provers. This article walks through the construction of a mini ML interpreter and, in particular, uses a novel approach to parsing based upon F# active patterns. This allows us to write a lexer and parser for a toy functional language in under 100 lines of vanilla F# code..."


To read this article and more, subscribe to The F#.NET Journal today!

Saturday, 5 November 2011

Scalable servers with async F#

We recently pitted a traditional server built using synchronous C# 4, ADO.NET and WCF with an equivalent solution built using asynchronous F#, ADO.NET and Google Protocol buffers over sockets. The characteristics of the two solutions really demonstrate the advantages of an asynchronous approach when using .NET. Specifically, our asynchronous solution was found to have the following advantages:

  • 2× lower CPU usage¹

  • 12× lower memory usage¹

  • 90× lower max latency

  • 10× higher max client connections

  • 4× less code!

¹ with a constant stream of queries.

The basic ideas behind this real-world asynchronous server have already been covered in the following F#.NET Journal articles:

Furthermore, the forthcoming .NET 4.5 will be the first to provide a fully asynchronous ADO.NET interface by adding a new ReadAsync method to read individual records from a database query asynchronously. This will make it possible to write fully asynchronous database code in .NET for the first time.

Drawing tree maps

The F#.NET Journal just published an article about visualization:

"A tree map is a simple way to visualize the relative sizes of a collection of objects in 2D. The idea is to recursively subdivide a rectangle into non-overlapping rectangles that have areas proportional to the weights they represent..."

To read this article and more, subscribe to The F#.NET Journal today!