dpes8693 / frontend-mentor-program-1rd

前端培訓
0 stars 1 forks source link

詹珀柚_HW6&Question #51

Closed JamesChan0107 closed 2 months ago

JamesChan0107 commented 2 months ago
  1. HW6:同步非同步.md
  2. Question:我很好奇,讀了關於async/await的觀念,幾乎沒看到關於async/await提到有關效能的問題;想請教您在實務上,大量使用async/await,會不會導致整體執行的效能降低?
dpes8693 commented 2 months ago
dpes8693 commented 2 months ago

2. Question:我很好奇,讀了關於async/await的觀念,幾乎沒看到關於async/await提到有關效能的問題;想請教您在實務上,大量使用async/await,會不會導致整體執行的效能降低?

這個問題比較進階了會需要懂 Event Loop 參考: https://medium.com/infinitegamer/why-event-loop-exist-e8ac9d287044

簡單來說不用擔心大量使用 async/await 導致效能降低的問題 JS不會卡在那邊傻傻地等,會自己去找事情做!

開發時只要專注在 => 想清楚 為什麼要要使用等待(await)