Errata

Multithreaded Javascript

Errata for Multithreaded Javascript

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page Don't have the book with me, currently on the go
Chapter 3

Hi there Oreilly Tech Team,

thanks for taking the time,

In your book: Multithreaded Javascript by Thomas Hunter, Bryan English

In Chapter Three, they are covering two examples of generating happy coins, some pseudo cryptocurrency, dons’t really matter aka something computing intensive. They are demonstrating that this is computing intensive and takes 1min 45seconds on their machine and using worker thread aka multi-threading it only takes them 33seconds. With is a huge performance improvement.

The hardware I am running the examples on:
M1 MacBook Pro 13 16Gb Ram.

In the book the authors are using node 16.

Running the example using node 20 the current lts version produces quite different results.

Using no workerthreas: 33s
Using workerthreas: 55s

Meaning that the multithreaded version actually takes longer then the original.

If I change my node version to 16, I get the expected results, but still, I am wondering why this is the case.
I copied the code from the git repo. Its one to one the same code as they are provided in the book and in the github account I just added the console.time to get a better feeling for what is happening.

I know this is not 100% the scope of the book since they are using node 16 and I am using node 20 but since this is the current LTS and this book is generally speaking pretty timeless I would really be curious what the issue is here since this is undermining the base preemies of the book, meaning Multithreaded JavaScript makes your code faster if done right. Maybe this could be published as an Errata so that other people who trip over the issue, can find the solution there.

looking forward to your answer.

Jan-Niklas Klocke  Nov 29, 2023