GithubHelp home page GithubHelp logo

Comments (6)

vamsikrishnacse avatar vamsikrishnacse commented on May 26, 2024

Hi @Destanci, i would like to work on this task!
is this the work flow you are expecting from async method to do?

getAll() method called
Stopwatch started
getStore() awaited
[STOPWATCH] Store get time: X milliseconds
getAllAsync() awaited
[STOPWATCH] Database result time: Y milliseconds
getAll() method completed

from objectbox-dart.

huseyin-kucuksahin avatar huseyin-kucuksahin commented on May 26, 2024

method is just fine with sync or async doesnt really matters. My question is, is there anything wrong with the async functions? no? then why it tooks 100times more time to get the data with async?

from objectbox-dart.

vamsikrishnacse avatar vamsikrishnacse commented on May 26, 2024

When i see the code Async the code line var entities = await store.box().getAllAsync(); is using await function which will wait until it gets the result and i thing you are using getall() function in async code pls check. I may be wrong!
this may be a solution for the entities variable await usage:

var entitiesFuture = store.box<TEntity>().getAllAsync();

// Perform other tasks while waiting for getAllAsync to complete.

// Now, await the result of getAllAsync when needed.
var entities = await entitiesFuture;

from objectbox-dart.

huseyin-kucuksahin avatar huseyin-kucuksahin commented on May 26, 2024

nah, measured the time outside of the function too. changing the position of awaiting does not make sense at all. since if you didnt start to await that Future wont start working right?. Also nothing else to do between that 2 lines.

from objectbox-dart.

greenrobot-team avatar greenrobot-team commented on May 26, 2024

@Destanci As documented, the async methods spawn a worker isolate to complete the box operation. That naturally takes some more time than directly calling the database API.

However, 2 seconds vs. 2 microseconds seem rather long. As you mentioned it, did you test in release mode? This is where we also measure performance and did not find that much of a penalty for using the async variants.

Note: @vamsikrishnacse is not associated with ObjectBox. I've also hidden the comments of that discussion.

from objectbox-dart.

github-actions avatar github-actions commented on May 26, 2024

Without additional information, we are unfortunately not sure how to resolve this issue. Therefore this issue has been automatically closed. Feel free to comment with additional details and we can re-open this issue.

from objectbox-dart.

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.