Project

iseqc

0.0
The project is in a healthy, maintained state
Compile ruby to YARV instruction sequence, link iseq from multiple files into a binary and do fast require/load in MRI
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
 Dependencies
 Project Readme

iseqc

YARV Instruction Sequence compiler and linker for RubyGems

Usage

Pack

require 'iseqc'
package = 'example.rpk'
source_dir = 'example'
Iseqc::Pack.pack(package, source_dir)

Load

require 'iseqc'
package = Iseqc::Unpack.unpack('example.rpk')
package.require 'file'

Benchmark

$ ruby bench/gen_cases.rb
$ ruby bench/bench.rb

Format

File

+----------------------------------------+
|                  File                  |
+--------+-------+--------+-----+--------+
| Header | Index | Iseq 0 | ... | Iseq x |
+--------+-------+--------+-----+--------+

Header

+---------------------------------------------+
|              Header: 256 bits               |
+-----------------------+---------------------+
| MRI Version:  32 bits | Page Size:  32 bits |
+-----------------------+---------------------+
| Index Size:   32 bits | Iseq Start: 32 bits |
+-----------------------+---------------------+
| File CRC32:   32 bits | Padding:    32 bits |
+-----------------------+---------------------+
|               Padding: 32 bits              |
+-----------------------+---------------------+

Index

# Marshal dump/load Hash
{
  '/usr/bin/ruby' => { offset: 0, size: 114514 },
  '/home/kowalski/example.txt' => { offset: 114514, size: 1919 }
}