• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home » Resolved: Using @async @sync macros to improve performance

Resolved: Using @async @sync macros to improve performance

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I’m trying to parallelize this function by using @async @sync
The way I’m using the macros seems correct to me but the performance just gets worse Without the macros:
With the macros:
I’ve even tried using @spawn instead of @async but the performance still won’t improve. I’ve checked the number of threads running with Threads.nthreads() and they are 4

Answer:

Your code is sequential, as you have a recursive dependence in res – so trying to parallelize it is both not possible and can lead to incorrect results. Essentially your code tries to re-implement foldr in a less efficient and non-generic way:

If you have better answer, please add a comment about this, thank you!

julia multithreading performance task
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How to efficient create SimpleITK image?

01/04/2023

Resolved: How can I write CSS selector(s) that apply to table rows for all td elements on that row after a td with a certain class?

01/04/2023

Resolved: How do I use SetWindowText with Unicode in Win32 using PowerShell?

01/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.