Skip to content

test binarytrees working with only one thread #42774

Open
@C-Ackerman

Description

@C-Ackerman

Version

v16.14.2

Platform

Linux chen 5.13.0-39-generic #44~20.04.1-Ubuntu SMP Thu Mar 24 16:43:35 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Node executes 1.js and then uses top -H -p to view, only one thread works 100%, but the v12.18.4 version can execute concurrently with multiple threads,So when the amount of operation of the tree is large enough, v12 is more than v
16 operations are fast
https://github.com/hanabi1224/Programming-Language-Benchmarks/blob/main/bench/algorithm/binarytrees/1.js

$ node 1.js 21
$ top -H -p

v16.14.2:

top - 17:39:12 up 1 day, 22 min,  1 user,  load average: 0.41, 0.50, 0.46
Threads:   7 total,   1 running,   6 sleeping,   0 stopped,   0 zombie
%Cpu(s):  7.0 us,  2.8 sy,  0.0 ni, 90.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  23818.0 total,    641.0 free,  13632.2 used,   9544.8 buff/cache
MiB Swap:  49152.0 total,  47951.2 free,   1200.8 used.   7510.3 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                                     
  92913 ack   20   0 1028048 480700  28820 R  94.3   2.0   0:08.73 node                                                                                                                                        
  92916 ack   20   0 1028048 480700  28820 S   6.0   2.0   0:00.47 node                                                                                                                                        
  92917 ack   20   0 1028048 480700  28820 S   6.0   2.0   0:00.54 node                                                                                                                                        
  92915 ack   20   0 1028048 480700  28820 S   5.0   2.0   0:00.47 node                                                                                                                                        
  92918 ack   20   0 1028048 480700  28820 S   4.3   2.0   0:00.47 node                                                                                                                                        
  92914 ack   20   0 1028048 480700  28820 S   0.0   2.0   0:00.00 node                                                                                                                                        
  92919 ack   20   0 1028048 480700  28820 S   0.0   2.0   0:00.00 node 

v12.18.4:

top - 17:44:01 up 1 day, 27 min,  1 user,  load average: 1.09, 0.65, 0.52
Threads:   7 total,   1 running,   6 sleeping,   0 stopped,   0 zombie
%Cpu(s): 10.4 us,  4.7 sy,  0.0 ni, 84.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  23818.0 total,   1136.4 free,  13659.7 used,   9021.9 buff/cache
MiB Swap:  49152.0 total,  47892.2 free,   1259.8 used.   7468.0 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                                     
  93716 ack   20   0  970844 452148  27948 R  98.7   1.9   0:13.18 node                                                                                                                                        
  93721 ack   20   0  971100 452412  27948 S  22.3   1.9   0:02.42 node                                                                                                                                        
  93719 ack   20   0  970844 452412  27948 S  15.3   1.9   0:01.92 node                                                                                                                                        
  93720 ack   20   0  970844 452412  27948 S  15.3   1.9   0:02.21 node                                                                                                                                        
  93718 ack   20   0  970844 452148  27948 S  15.0   1.9   0:02.07 node                                                                                                                                        
  93717 ack   20   0  970844 452148  27948 S   0.0   1.9   0:00.00 node                                                                                                                                        
  93722 ack   20   0  971100 452412  27948 S   0.0   1.9   0:00.00 node

How often does it reproduce? Is there a required condition?

always

What is the expected behavior?

Can be executed concurrently by multiple threads

What do you see instead?

Only single thread works 100%

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.performanceIssues and PRs related to the performance of Node.js.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions