We regressed this at some point in the past year, oops; it is probably a bug in the CTP compiler. Ensuring we generate the right code for the common-case for-loop is now under unit test, so future releases should be good. (Your F# source is fine, it's the F# compiler that's at fault.) I don't know a workaround (other than calling out to C#).

By on 3/31/2009 10:55 PM ()

Oh, well, one more reason to desperately wait for 2010 Beta 1 :\.

I wonder if there's some hackery using the inline IL feature that could handle this...

By on 4/1/2009 2:32 AM ()

Heh. If you're looking for hackery why not just make a P/Invoke to WriteProcessMemory (which should be faster than the C# as well). Now that I think about it I'm not sure if F# has the equivalent of the C# "fixed" keyword.

Edit: That's what I get for waking up so early. I meant P/Invoke to memset, obviously :(

You should also be able to emit IL directly if you just need something to hold you over until VS 2010, lol.

By on 4/1/2009 6:13 AM ()

Because figuring out the inline IL parser is going to be more fun and interesting than P/Invoke? :)

By on 4/1/2009 9:38 AM ()

Actually the IL method I had in mind turned out to be more compliacted than I thought. For some reason I thought the initblk opcode took a 32-bit integer argument, but it's only 8 :(

Now that I think about it I'm not even sure why there isn't an IL opcode for initializing a block of memory with something other than a byte, x86 supports it natively through a number of different instructions and even the slowest way is way faster faster than looping.

By on 4/1/2009 2:02 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper