You can use [<Struct>] attribute or 'struct' keyword, see

[link:research.microsoft.com]

By on 9/29/2008 12:19 AM ()

However, F# always generates getter and setters for fields, even for the fields of structs. This can for example be a problem if you have nested structs. As far as I know, the only workaround is to define your types in a C# DLL.

Stephan

By on 9/29/2008 12:42 AM ()

Too sad.
This does significant decrease in performance in comparison with C#.
Could expect improvement of this?

By on 10/1/2008 8:27 AM ()

Hmmm... The F# CTP access fields via the "ldfld" and "ldflda" instructions when accessing struct-typed fields within the same assembly. Could you send along the short benchmark where you're seeing the difference w.r.t. C#? Does it involve multiple assemblies?

thanks

don

By on 10/2/2008 8:47 AM ()

Sorry for delay

Here is small project that disappoint me. In fact I've tried to release some functions that exist in XNA, but I cannot get similar performance.
My counters show
Test_XNA_Struct 2662880
Test_Custom_Struct 4855840
ticks.
NProf show similar results
Test_XNA_Struct ~7%

Test_Custom_Struct ~13%
Only reason I can see it is accessing fields of struct thru properties in F#.

Maybe I'm wrong.

B.R.
Pavel

By on 10/6/2008 10:35 AM ()
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