major difference in performance between sync and async methods to download tensor data
See original GitHub issuewhen using webgl
backend, tensor.dataSync()
is about 35% faster than await tensor.data()
when returning larger amounts of data
(in my case, model takes 720x720x3 image as input and produces 720x720x3 image as output)
actual timings are ~100ms for tensor.dataSync()
and ~140ms for await tensor.data()
note that there is nothing else executing, this is a single active loop
i wouldn’t mind using dataSync()
, but then again any sync calls are not compatible with webgpu
backend and maintaining two separate codepaths for webgl
and webgpu
is a no-op
btw, model in question can be found at https://github.com/vladmandic/anime
environment: tfjs 3.19…0 on chrome 103
Issue Analytics
- State:
- Created a year ago
- Comments:37 (24 by maintainers)
Top Results From Across the Web
Sync vs. Async Python: What is the Difference?
For most applications, I do not believe the performance difference between sync and async context switches amount to anything significant.
Read more >Better performance with the tf.data API | TensorFlow Core
However, in a naive synchronous implementation like here, while your pipeline is fetching the data, your model is sitting idle. Conversely, while your...
Read more >Advanced API Performance: Async Compute and Overlap
This post covers best practices for async compute and overlap on NVIDIA GPUs. To get a high and consistent frame rate in your...
Read more >Asynchronous vs synchronous execution. What is the ...
So an asynchronous task is not co-coordinated with other tasks, whereas a synchronous task IS co-coordinated with other tasks, so one finishes before...
Read more >Sync, async, and promises | Cloud Functions for Firebase
// set() returns a promise. We keep the function alive by returning it. return event.data.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mattsoulanille @gyagp i just created emscripten issue for this as this is really something that should be patched there - imo anything you do here is just a workaround to avoid bad emscripten behavior
Are you satisfied with the resolution of your issue? Yes No