Mijago / D2ArmorPicker

GNU Affero General Public License v3.0
136 stars 40 forks source link

Improve perfomance from workers #169

Closed nznaza closed 6 months ago

nznaza commented 1 year ago

Since Web Workers copy and serialize (and the main thread deserializes the objects again), reducing the overhead of object creation, transmit, and de/serialization by creating smaller objects from the workers to be transmitted and creating the objects in the main thread offers a performance boost up to ~40%, and since the serialization is quicker as well, it has a better # workers scalability.

Same number of workers as beta (3) ~40% better time image

Double number of workers (6) ~60% better time image

This PR does not change the number of workers, it appears to be working well in live with 3, but since it scales good it might be a good idea to add a user selectable number of workers. Changing the batch size (since data is smaller) looks like a good idea but doesn't improve significantly the results.

Used config for tests: eyJlbmFibGVkTW9kcyI6W10sImRpc8USSXRlbccTYWRkQ29uc3RlbnQxUmVzaWxpZW5jZSI6ZmFsc2UsImFzc3VtZUV2ZXJ5TGVnZW5kYXJ5SXNBcnRpZmnLJ3B1dMgUxm50cnVlLCJ1c2VGb3RsQXJtb3LJLG1heGltdW1TdGF0xiw1LCJvbmx5VXNlTWFzdGVyd29ya2VkRXhvdGljc8k30yPoAJJpZconaWdub3JlU3Vuc2V0znhpbmNsdWRlQ29sbGVjdGlvblJvbGzLOcYfVmVuZG9yzhthbGxvd0JsdWXFUVBpZWPEceYA4+YBIesAiuwAoc4l5wDS2iFDbGFzc+QBnNQjbGltaXRQYXJzZWRSZXN1bHTpAINtb2RPcHRpbWl6YeQA11N0cmF0ZWd5IjoxLCJ0cnlMxDlXxFJk5AF0yTfkAVFTaG93x05XaXRoTm/NKOcA/3Nob3fLGENvbHVtbs0eUG/kAkBpYWxUaWVyzyBjaGFyYWN0ZXLlAN4iOjIsInNl5AGC5QKZRWxlbWVudOUArMgX6QH65AKg5wIuTW9kU2xv5ACVeyIwxAVmaXjkARzHZXZhbHVlIjo1fSwiMd0eMt0eM90eNN0eNdsefSwiYeUCO2Vya/EAw+YBjscsMO8AwtEd7ADB0R3sAMDRHewAv9Ed7AC+zx19LCJtaW7oA7PkAeL/AYbwAMTOHjHwAMbSPfoBh/AAyNIe+gGH5QDK8wRG5wUNxy1jb25maWd1cuUDS8RM/wVF/wVF/wVF/wVF+gVF/wUx1yP/BTH/BTH/BTH/BTH/BTH/BTHWIf8FMf8FMfIFMTD3BTHrAVL/BTL/BTL/BTL2BTIw/wUy/wUy/wUy/wUy/wUy/wUy3R7/BTL/BTL/BTL/BTL/BTL/BTL/BTL/BTL/BTLVHv8FMd0e/wUx2x59fX0=

nznaza commented 1 year ago

Here's a deploy using GitHub pages with 6 workers and the changes, to test them without needing to clone the repo https://nznaza.github.io/D2ArmorPicker/

Mijago commented 1 year ago

Hi, I did not forget this; But I am currently moving to a different apartment and will not have time for this until I have internet there (in a week). Thank you for the contribution and sorry for the delay.

nznaza commented 7 months ago

Just pushed a merge from upstream to fix conflicts