Hacker News 中文摘要

RSS订阅

lsr:基于io_uring的ls命令 -- lsr: ls with io_uring

文章摘要

文章介绍了一个名为lsr的工具,它是基于io_uring技术实现的ls(1)命令的替代品。用户可以通过Zig构建系统进行安装,并提供了详细的安装和用法说明。lsr支持多种显示选项,如单行输出、显示隐藏文件、按列输出等,并且可以根据需要启用颜色和超链接功能。

文章总结

文章标题为 @rockorager.dev/lsr,介绍了一个名为 lsr 的命令行工具,它是基于 io_uring 技术的 ls(1) 命令的改进版本。

主要内容总结:

  1. 工具介绍

    • lsr 是一个使用 io_uring 技术的命令行工具,旨在提高文件列表显示的性能。
    • Image 1: screenshot
  2. 安装

    • lsr 使用 Zig 构建系统,需要 Zig 0.14.0 版本。
    • 安装命令为: bash zig build -Doptimize=ReleaseSmall --prefix $HOME/.local
    • 安装后,lsr 和相关的 man 手册会被安装到指定目录。
  3. 使用

    • lsr 支持多种选项,如显示隐藏文件、按列输出、显示扩展文件元数据、按时间排序等。
    • 示例命令: bash lsr [options] [path]
  4. 性能测试

    • 文章提供了 lsr 与其他类似工具(如 lsezalsd 等)的性能对比。
    • 测试内容包括执行时间和系统调用次数,结果显示 lsr 在大多数情况下表现更优。
  5. Git 操作

    • 提供了通过 HTTP 和 SSH 克隆项目的命令: bash git clone https://tangled.sh/@rockorager.dev/lsr git clone git@tangled.sh:rockorager.dev/lsr

总结:

lsr 是一个基于 io_uring 技术的 ls 命令改进版,通过优化系统调用和性能测试,展示了其在文件列表显示任务中的高效性。文章详细介绍了安装、使用方法和性能对比,并提供了 Git 克隆项目的命令。

评论总结

  1. 链接问题

    • 评论1和评论3指出链接无法正常工作。
    • 引用:
      • "Link doesn’t work" (评论1)
      • "The link isn’t working for me." (评论3)
  2. io_uring的性能优势

    • 评论2、评论4、评论12和评论13讨论了io_uring在提升I/O性能方面的潜力,尤其是在NVMe和NFS场景下的表现。
    • 引用:
      • "If I use tools with aio or iouring I get 1005MB/s." (评论2)
      • "I wonder if iouring mitigates the bad parts somewhat." (评论4)
      • "I am yet to come across a some tests that simulate typical real life application workload." (评论12)
      • "The primary benefit is bulk statting (ls -l)." (评论13)
  3. lsr与ls的对比

    • 评论5、评论10和评论15讨论了lsr与ls的差异,包括颜色支持和性能提升,但有人认为性能提升在实际使用中并不明显。
    • 引用:
      • "Yes lsr also colors the output but it doesn’t know as many things as eza does." (评论5)
      • "Why does this require inventing lsr as an alternative to ls instead of making ls use io_uring?" (评论10)
      • "If I’m listing 10,000 files the difference is between 40ms and 20ms." (评论15)
  4. 技术实现与编程语言

    • 评论5、评论9和评论16讨论了Zig语言的使用以及内存分配器的选择,还有人提出是否可以让libc直接使用io_uring。
    • 引用:
      • "I also like that it’s written in zig which imo feels way more easier for me to touch as a novice than rust." (评论5)
      • "Does it mean that all allocations need to be written with an allocator in mind?" (评论9)
      • "Why isn’t it possible — or is it — to make libc just use uring instead of syscall?" (评论16)
  5. 其他工具和平台

    • 评论8和评论11提到了tangled.sh平台和uutils项目,认为这些平台和项目在推动核心工具现代化方面有潜力。
    • 引用:
      • "This was more interesting for the tangled.sh platform it’s hosted on." (评论8)
      • "I feel like they’re our best hope for an organization to drive this sort of core modernization forward." (评论11)

总结:评论主要围绕iouring的性能优势、lsr与ls的对比、技术实现细节以及相关平台和工具展开。虽然iouring在性能上有显著提升,但实际使用中的感知差异较小,且存在一些技术实现上的疑问和挑战。