Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm ls is still slow #7820

Open
2 tasks done
Rudxain opened this issue Oct 6, 2024 · 7 comments
Open
2 tasks done

[BUG] npm ls is still slow #7820

Rudxain opened this issue Oct 6, 2024 · 7 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@Rudxain
Copy link

Rudxain commented Oct 6, 2024

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

npm/npm#6507

  • On an Dell Inspiron 15R, with its HDD replaced by an SSD, running Debian 13 (Node LTS), it takes ~1.2s
  • On a Samsung Galaxy A31, from Termux repos (Node latest), it takes ~3s

It's slow, both with and without -g flag. Even on directories that contain no package.json

Expected Behavior

It should be sub ~500ms

Steps To Reproduce

  1. On Debian or Termux
  2. Run time npm list (-g optional)
  3. See timings

Environment

  • npm: 10.9.0
  • Node.js: v20.17.0
  • OS Name: Debian 13 "Trixie"
  • System Model Name: Inspiron 5521
  • npm config:
; copy and paste output from `npm config ls` here
; TO-DO
@Rudxain Rudxain added Bug thing that needs fixing Needs Triage needs review for next steps labels Oct 6, 2024
@OS-Scratch
Copy link

I'm using npm 11.0.0 and it works fine for me (output: [email protected] D:\Websites\HTML-CSS-OLD -- [email protected]). The results come in in about 3 secs.

@Rudxain
Copy link
Author

Rudxain commented Dec 29, 2024

TCL 505, Node 23.5.0, :

~ > time npm ls
/data/data/com.termux/files/home
└── (empty)


real    0m4.970s
user    0m4.736s
sys     0m0.975s
~ > time npm ls -g
/data/data/com.termux/files/usr/lib
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]


real    0m6.980s
user    0m7.297s
sys     0m1.265s
~ > time node --eval '' # for reference

real    0m0.730s
user    0m0.594s
sys     0m0.124s

@Rudxain Rudxain changed the title [BUG] npm list is still slow [BUG] npm ls is still slow Dec 29, 2024
@OS-Scratch
Copy link

You have the early-release version, as I can tell. Try the 22.x (LTS) one, it should work there.

@kchindam-infy
Copy link

@Rudxain checked the isuue what u menioned and the enviroment specified by u . the time taken is ~3s for the specified environment what u mentioned . please provide the detailed information to reproduce the issue

@Rudxain
Copy link
Author

Rudxain commented Dec 31, 2024

Note

Before I reply to comments, I want to apologize to maintainers for sending too much Termux "benchmarks". I'm aware I should report those issues here.

I'll send more Debian benchmarks in some minutes.

And I'm aware that the same reasoning applies to Debian, as I've installed Node and NPM from deb repos, not upstream/mainline.

Try the 22.x (LTS)

nodejs-lts (v22.12.0) is worse (I forgot to update NPM after installing LTS 🤦):

~ > time npm ls
/data/data/com.termux/files/home
└── (empty)
                            
real    0m6.424s
user    0m5.966s
sys     0m0.989s
~ > time npm ls -g
/data/data/com.termux/files/usr/lib
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]


real    0m8.625s
user    0m8.174s
sys     0m1.440s
~ > time node --eval ''

real    0m0.779s
user    0m0.612s
sys     0m0.136s

~3s

That's odd 😕

please provide the detailed information

`termux-info`
Termux Variables:
TERMUX_API_APP__VERSION_NAME=0.50.1+8651fd9
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP__AM_SOCKET_SERVER_ENABLED=true
TERMUX_APP__APK_PATH=/data/app/~~WPXCfHF4H26HCo78tc39TA==/com.termux-NIgiCJmmSeJ7UdS3WPGxMA==/base.apk
TERMUX_APP__APK_RELEASE=GITHUB
TERMUX_APP__FILES_DIR=/data/user/0/com.termux/files
TERMUX_APP__IS_DEBUGGABLE_BUILD=true
TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE=false
TERMUX_APP__PACKAGE_MANAGER=apt
TERMUX_APP__PACKAGE_NAME=com.termux
TERMUX_APP__PACKAGE_VARIANT=apt-android-7
TERMUX_APP__PID=22902
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c225,c256,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_APP__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c225,c256,c512,c768
TERMUX_APP__TARGET_SDK=28
TERMUX_APP__UID=10225
TERMUX_APP__USER_ID=0
TERMUX_APP__VERSION_CODE=118
TERMUX_APP__VERSION_NAME=0.118.0+fb01127
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0+fb01127
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.dev/apt/termux-main stable main
Updatable packages:
All packages up to date
termux-tools version:
1.44.6
Android version:
14
Kernel build information:
Linux localhost 5.10.198-android12-9-00085-g226a9632f13d-ab11136126 #1 SMP PREEMPT Wed Nov 22 14:16:37 UTC 2023 aarch64 Android
Device manufacturer:
TCL
Device model:
T509A
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.api versionCode:51

I had to install the new termux-exec.

npm config (after reinstalling latest):

; "user" config from /data/data/com.termux/files/home/.npmrc

foreground-scripts = true

; node bin location = /data/data/com.termux/files/usr/bin/node
; node version = v23.5.0
; npm local prefix = /data/data/com.termux/files/home
; npm version = 10.9.2
; cwd = /data/data/com.termux/files/home
; HOME = /data/data/com.termux/files/home
; Run `npm config ls -l` to show all defaults.

@Rudxain
Copy link
Author

Rudxain commented Dec 31, 2024

  • npm: 11.0.0
  • Node.js: 20.18.1+dfsg-1
  • OS Name: Debian 13 "Trixie"
  • System Model Name: dynabook TECRA A30-G
  • npm config:
; "builtin" config from /usr/local/lib/node_modules/npm/npmrc

globalignorefile = "/etc/npmignore"
prefix = "/usr/local"

; node bin location = /usr/bin/node
; node version = v20.18.1
; npm local prefix = /home/rudxain
; npm version = 11.0.0
; cwd = /home/rudxain
; HOME = /home/rudxain
; Run `npm config ls -l` to show all defaults.
rudxain ~ > time npm ls
/home/rudxain
└── (empty)


real	0m1.347s
user	0m1.353s
sys	0m0.274s
rudxain ~ > time npm ls -g
/usr/local/lib
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]


real	0m2.226s
user	0m2.338s
sys	0m0.470s
rudxain ~ > time node --eval ''

real	0m0.244s
user	0m0.209s
sys	0m0.034s

Note

  • That PC has an NVME SSD
  • The Inspiron has a SATA SSD 2connet 2C-DS05
  • The TCL has eMMC 5.1

@ljharb
Copy link
Contributor

ljharb commented Dec 31, 2024

@Rudxain i would avoid using termux with npm, because termux sets PREFIX, which npm also uses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps
Projects
None yet
Development

No branches or pull requests

4 participants