Rubygem-zeitwerk

Jul 20, 2023

Efficient and thread-safe code loader

Zeitwerk is an efficient and thread-safe code loader for Ruby.

Given a conventional file structure, Zeitwerk is able to load your project’s classes and modules on demand autoloading, or upfront eager loading. You don’t need to write require calls for your own files, rather, you can streamline your programming knowing that your classes and modules are available everywhere. This feature is efficient, thread-safe, and matches Ruby’s semantics for constants.

Zeitwerk is also able to reload code, which may be handy while developing web applications. Coordination is needed to reload in a thread-safe manner. The documentation below explains how to do this.

The gem is designed so that any project, gem dependency, application, etc. can have their own independent loader, coexisting in the same process, managing their own project trees, and independent of each other. Each loader has its own configuration, inflector, and optional logger.

Internally, Zeitwerk issues require calls exclusively using absolute file names, so there are no costly file system lookups in $LOAD_PATH. Technically, the directories managed by Zeitwerk do not even need to be in $LOAD_PATH. Furthermore, Zeitwerk does only one single scan of the project tree, and it descends into subdirectories lazily, only if their namespaces are used.



Checkout these related ports:
  • Zziplib - Library to provide transparent read access to zipped files
  • Zydis - Fast and lightweight x86/x86-64 disassembler library
  • Zycore-c - Support library with platform independent types, macros, etc for Zydis
  • Zthread - Platform-independent object-oriented C++ threading library
  • Zookeeper - Coordination Service for Distributed Applications
  • Zls - Zig LSP implementation + Zig Language Server
  • Zfp - High throughput library for compressed floating-point arrays
  • Zeal - Offline documentation browser
  • Zapcc - C++ caching compiler based on clang
  • Zanata-platform - Web-based translation platform
  • Zanata-cli - Zanata Java command line client
  • Z88dk - Complete Z80/Z180 development kit
  • Z80ex - ZiLOG Z80 CPU emulator library
  • Z80asm - Assembler for the Z80 microprocessor
  • Z80-asm - Z80 assembly code assembler and disassembler