Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locking Hopac threads #108

Open
Horusiath opened this issue Jun 21, 2016 · 6 comments
Open

Locking Hopac threads #108

Horusiath opened this issue Jun 21, 2016 · 6 comments

Comments

@Horusiath
Copy link

Horusiath commented Jun 21, 2016

I'm writing here, since I don't have a place to ask a question.

I'm trying to use Hopac within a library in hope to get some performance boost over existing work done with Async (link to PR). However moving to Hopac from Async turned to even more performance degradation. After some profiling I've managed to get some snapshot from sample executing program:

It looks like Hopac-managed threads (top 4 on the image) are waiting idle for 70-80% of their time - ManualResetEventSlim.Wait and Monitor.Wait are probably invoked from Hopac itself. What can cause that?

The code I'm using, consists only of Job operations, no channels, ivars or alternatives, no explicit locks:

  • Job.result
  • Job.raises
  • Job.conCollect
  • Job.conIgnore
  • Job.seqIgnore (however it's not used in the execution path, the picture reffers to)
  • Async.Global.ofJob to expose job as async to public API

Any help will be appreciated.

@polytypic
Copy link
Member

FYI, I'm currently quite busy at work and otherwise so it might take some time before I have time to look into this properly.

@polytypic
Copy link
Member

Build of FSharp.Data.GraphQL seems to be failing at the moment. How can the project be built and the benchmark run?

@Horusiath
Copy link
Author

Horusiath commented Jun 25, 2016

It's strange - build should be possible from dev branch. The image I've attached has been made using DotTrace Performance Profiler on sample console application. Should I share full example somewhere to reproduce the problem?

@polytypic
Copy link
Member

polytypic commented Jun 25, 2016

I did a git clone and checked out dev and tried to run build.sh from OS X, build.cmd from Windows, and tried to build Release from VS 2015. Both build scripts produced a ton of warnings and errors and ultimately reported failure. Build from VS also failed. So, what is the correct way to build it?

@Horusiath
Copy link
Author

@polytypic could you try again with the latest version. It should work now.

@polytypic
Copy link
Member

FYI, I managed to compile and run the benchmarks. So, I'll take a closer look at the code when I get time. Based on my previous brief look at the code, it seemed like you were basically using Hopac for parallelism rather than async and that there might not be very large amounts of parallel jobs to execute. If so, then in such a case one needs to be careful to get the jobs running on many worker threads.

BTW, doc generation seems to fails when you try to build from a fresh clone. Also, the benchmarks do work on Windows+.Net, but do not work on OS X+Mono.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants