Rash thoughts about .NET, C#, F# and Dynamics NAV.


"Every solution will only lead to new problems."

Friday, 7. May 2010


Using a MailboxProcessor to speedup “FAKE – F# MAKE”

Filed under: F#,FAKE - F# Make — Steffen Forkmann at 11:37 Uhr

Earlier today I released “FAKE – F# Make” version 1.10.0. This new release contains a lot path issue fixes for Mono and a new architecture for logging and tracing.

A guy named Joel Mueller had an awesome idea and sent me some patches. He noticed that TraceHelper.fs writes all messages synchronously to the console and/or a XML output file, which means the actual build operations must wait on the writing of hundreds of trace messages, slowing down the actual build.

His idea was to use a MailboxProcessor to buffer up the trace messages and write them out asynchronously, so that the actual build can proceed at full speed.

type Message =

    { Text      : string

      Color     : ConsoleColor

      Newline   : bool

      Important : bool}

 

/// ….

 

let buffer = MailboxProcessor.Start (fun inbox ->

    let rec loop () =

        async {

            let! (msg:Message) = inbox.Receive()

            match traceMode with

            | Console -> logMessageToConsole msg

            | Xml     -> appendXML msg.Text

 

            return! loop ()}

 

    loop ())     

Now all internal logging and tracing functions can post their their messages to the inbox of the MailboxProcessor:

/// Logs the specified string (via message buffer)

let logMessage important newLine message =

    match traceMode with

    | Console ->

        { Text = message;

          Important = important;

          Newline = newLine;

          Color = ConsoleColor.White }

          |> buffer.Post

    | Xml     ->

        { defaultMessage with

            Text = sprintf "<message><![CDATA[%s]]></message>"

                     message }

          |> buffer.Post

This idea reduces the build time of FAKE’s self build from 3 min. to 2 min. Which is really amazing, since I didn’t have to change anything in the build script. This version is compatible to the last released version.

Please download “FAKE – F# Make” version 1.10.0 and tell me what you think.

Tags: , , ,

Sunday, 3. June 2007


Navision Performance-Optimierung auf dem SQL-Server

Filed under: msu solutions GmbH,Navision,SQL Server — Steffen Forkmann at 11:28 Uhr

Seit Microsoft das SP1 für Dynamics Nav 4 heraus gebracht hat, gibt es neue C/AL-Befehle zur schnelleren SQL-Server-Abfrage. Da immer wieder Fragen dazu auftauchen, hier eine kleine Zusammenfassung.

(weiterlesen…)

Tags: , , , , , ,