Skip to content
This repository has been archived by the owner on May 8, 2022. It is now read-only.

Best practices around reusing Fuse objects? #42

Open
wearhere opened this issue May 15, 2020 · 0 comments
Open

Best practices around reusing Fuse objects? #42

wearhere opened this issue May 15, 2020 · 0 comments
Labels

Comments

@wearhere
Copy link
Contributor

If I repeatedly search over similar datasets with the same parameters, I wonder if I should use the same Fuse object for all searches:

let fuse = Fuse()

func search() {
  return fuse.search...
}

vs. using a new Fuse object for every search

func search() {
  return Fuse().search...
}

Of particular concern to me is that I am using the async APIs which rely on per-instance dispatch queues. I kind of like the idea of using a new Fuse object for every search so that the searches don't "compete" on the same dispatch queue, but I don't know if there's actually any limit to concurrency per-custom-queue (as opposed to at the level of the global queues that back these custom queues, or eventually at the level where the work items are scheduled on threads, in which case different Fuse objects would be competing anyway).

I also don't know if there's overhead to having many custom dispatch queues, in which case it would be better to reuse one Fuse object. This Stack Overflow makes it seem like this wouldn't be a problem.

@krisk krisk added the question label May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants