Skip to content

worker_threads or the threadpool? #1494

@AyushG3112

Description

@AyushG3112

Hi,

I'm trying to understand worker_threads module and I'm wondering which one of these is a better way to about calling crypto/fs etc APIs (which use the libuv threadpool and have a Sync variant)

Taking the crypto.pbkdf2 as an example, 2 options are:

Option 1: Normally calling crypto.pbkdf2() on the main thread
Option 2: Calling crypto.pbkdf2Sync() on a worker thread, thus preserving the libuv pool for other tasks

Could anyone point me out to which one is better, and why? If better is situational, I will appreciate some examples in which one might be better than the other. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions