I want to compare two collections of entity framework pocos based on union and intersection. I’m trying to find out if out of the box it would be better to process these sets using f# instead of linq?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t need to run a profiler — F# 3.0 supports LINQ, so you should be able to put together a small benchmarking project which uses both LINQ and the standard F#
Set<'T>and measures the time to complete whatever operations you need (useSystem.Diagnostics.Stopwatchfor this).Here’s the thing — the answer to this question is highly dependent on your exact needs, so you need to do a bit of testing to see which is faster for your use case. For example, if you create a little benchmark app and find that LINQ (in C# or F# 3.0) is faster by 10ms, do you just go with LINQ because it’s faster? Maybe, or maybe not — it depends on whether that 10ms savings is important for your application; in most cases, it probably isn’t, so you should go with whatever solution is easiest to integrate with the rest of your code.
Personally, I’d go with F# 3.0 and LINQ here, because it allows for a very succinct definition, and it may also be faster if EF can offload some or all of the computation to the database server.