Static Type Analysis for Ruby Without Type Annotations

2025-03-13
Static Type Analysis for Ruby Without Type Annotations

Shopify engineers have developed a novel static type analyzer that infers type information for Ruby programs without requiring type annotations. The analyzer leverages an improved Sparse Conditional Constant Propagation (SCCP) algorithm and precise dataflow tracking to efficiently handle interprocedural type analysis, completing analysis in seconds even for programs with a large number of classes. This research offers a new approach to optimizing compilers for dynamic languages and opens up new possibilities for performance improvements in dynamic languages like Ruby.

Read more
Development static type analysis

Speeding Up CRuby's FFI with JIT Compilation

2025-02-12
Speeding Up CRuby's FFI with JIT Compilation

This article explores using Just-In-Time (JIT) compilation to improve the performance of Ruby's Foreign Function Interface (FFI). Benchmarks demonstrate FFI's performance drawbacks compared to native extensions. The author introduces FJIT, a solution leveraging RJIT and custom machine code generation to create runtime machine code for calling external functions, bypassing FFI overhead. FJIT outperforms native extensions in tests, offering a high-performance alternative for Ruby developers. Currently a prototype supporting only ARM64, FJIT's future expansion to other architectures and more complex function calls is anticipated.

Read more
Development