rocks.nvim icon indicating copy to clipboard operation
rocks.nvim copied to clipboard

[Perf] Parallel `sync` and `update`

Open mrcjkb opened this issue 1 year ago • 9 comments

I think I have an idea for this:

Option 1

  • First, install (shared?) dependencies sequentially
  • Then update rocks in parallel

Option 2

Implement a per-package locking mechanism in luarocks

mrcjkb avatar Jun 25 '24 07:06 mrcjkb

I'm inclined to start with option 1 and refactor in case option 2 ever becomes a reality. We could pester hisham a bit to try and make that work :p (hell, maybe I can try to contribute, seems like a simplish thing to implement).

The processing time of checking shared dependencies is outweighed by the speed gains of parallel updates.

vhyrro avatar Jun 26 '24 10:06 vhyrro

Played around with this a bit more on the parallel-installs branch. The luarocks --force-lock option is completely broken when doing parallel installs.

luarocks needs either a way to lock installs per directory or an --ignore-lock option.

mrcjkb avatar Jul 08 '24 17:07 mrcjkb

Added an --ignore-lock flag to my fork of luarocks. Some packages seem to update fine, but others fail with

Warning: Failed searching manifest: Failed loading manifest for https://nvim-neorocks.github.io/rocks-binaries-dev/: Error loading file: [string "/tmp/luarocks_local_cache-7694486/https___nvi..."]:2887: ']' expected near '}'

error: no results matching query were found for lua 5.1.
to check if it is available for other lua versions, use --check-lua-versions.

It looks like we may have to improve the luarocks locking mechanism.

mrcjkb avatar Jul 08 '24 22:07 mrcjkb

Something maybe helpful: Before rocks sync support parallel, we can use parallel luarocks install ::: package1 package2 ... to do same work.

Freed-Wu avatar Jul 29 '24 07:07 Freed-Wu

That would add a dependency on GNU parallel, and would not solve the luarocks locking mechanism issue.

mrcjkb avatar Jul 29 '24 10:07 mrcjkb

Oh, I means before rocks.nvim support it. We can install the packages in command line.

Freed-Wu avatar Jul 29 '24 10:07 Freed-Wu

The issue is in luarocks, not rocks.nvim, so I don't think parallel will help.

mrcjkb avatar Jul 29 '24 16:07 mrcjkb

Why you not wrap luaraocks.cmd.install with uv.new_thread ?

amsitlab avatar Feb 18 '25 09:02 amsitlab

Why you not wrap luaraocks.cmd.install with uv.new_thread ?

Wouldn't help. Multiple instances of luarocks running in parallel leads to install tree corruption. Anyways, This issue will be closed with #539.

mrcjkb avatar Feb 18 '25 15:02 mrcjkb