Git Product home page Git Product logo

Comments (3)

Thorium avatar Thorium commented on May 25, 2024 1

Async and task are designed from a bit separate point of view: Async is good when you have many complex parallel workflows. Task is good when you want to execute a small thing now. Task is performance-wise way more faster. Most of SQLProvider things are "please execute me this query now", so the new task computation fits to SQLProvider scenario better.

All the database drivers that SQLProvider is using, are using tasks. Most of the APIs that SQLProvider is used in, are also now task-based. So there was no point of converting task->async->task.

That been said I cannot blindly recommend converting everything to task. I'd say as a rule of thumb: if you have a function that is less than 30 F# lines, then convert it to task. But if you have functions over e.g. 150 lines capsulated to task, they probably will just break runtime unless you break them to multiple separate non-nested-functions, to keep your tasks small. So keep them as async and just do Async.AwaitTask. Best indication is that if you compile in release mode and it gives you this warning warning FS3511: This state machine is not statically compilable. A resumable code invocation at '(...-...)' could not be reduced. that means the task might not be working runtime as it should.

from sqlprovider.

jimfoye avatar jimfoye commented on May 25, 2024

What was the rationale for number 2?

from sqlprovider.

jimfoye avatar jimfoye commented on May 25, 2024

I prefer async for the usual reasons (especially just that it's easier to reason about), but I see why you did it, thanks for the great explanation.

from sqlprovider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.