This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "fiddle" | |
require "ffi" | |
require "jit_buffer" | |
require "hacks" | |
require "aarch64" | |
require "benchmark/ips" | |
module FJIT | |
C = RubyVM::RJIT.const_get(:C) | |
include AArch64::Registers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "set" | |
require "rbconfig" | |
class Wrapper | |
def initialize | |
@a = Set.new | |
@b = Set.new | |
end | |
def write_a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tool/ruby_vm/views/_insn_entry.erb b/tool/ruby_vm/views/_insn_entry.erb | |
index 6ec33461c4..bc9a1d44b4 100644 | |
--- a/tool/ruby_vm/views/_insn_entry.erb | |
+++ b/tool/ruby_vm/views/_insn_entry.erb | |
@@ -64,7 +64,7 @@ INSN_ENTRY(<%= insn.name %>) | |
INC_SP(INSN_ATTR(sp_inc)); | |
% insn.rets.reverse_each.with_index do |ret, i| | |
TOPN(<%= i %>) = <%= insn.cast_to_VALUE ret %>; | |
- VM_ASSERT(!RB_TYPE_P(TOPN(<%= i %>), T_NONE)); | |
+ assert(!RB_TYPE_P(TOPN(<%= i %>), T_NONE)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "strscan" | |
class Scanner | |
TOK = [] | |
TOK["{".ord] = :LBRACE; TOK["}".ord] = :RBRACE; TOK[";".ord] = :SEMI | |
def initialize data | |
@scan = StringScanner.new data | |
@prev_pos = @scan.pos | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ make benchmark ITEM=vm_call | |
/Users/aaron/.rubies/arm64/ruby-trunk/bin/ruby --disable=gems -rrubygems -I./benchmark/lib ./benchmark/benchmark-driver/exe/benchmark-driver \ | |
--executables="compare-ruby::/Users/aaron/.rubies/arm64/ruby-trunk/bin/ruby --disable=gems -I.ext/common --disable-gem" \ | |
--executables="built-ruby::./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems --disable-gem" \ | |
--output=markdown --output-compare -v $(find ./benchmark -maxdepth 1 -name 'vm_call' -o -name '*vm_call*.yml' -o -name '*vm_call*.rb' | sort) | |
compare-ruby: ruby 3.4.0dev (2024-04-12T17:49:17Z master 1521af3259) [arm64-darwin23] | |
built-ruby: ruby 3.4.0dev (2024-04-12T19:48:34Z speed-forward 0265c020ed) [arm64-darwin23] | |
warming up........ | |
# Iteration per second (i/s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RBTree | |
module M | |
def insert val | |
RBTree.insert self, val | |
end | |
alias :<< :insert | |
def include?(...) = key?(...) | |
end | |
class Leaf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mDNS client | |
# | |
# Usage: ruby script.rb "_http._tcp.local." | |
require "socket" | |
require "ipaddr" | |
require "fcntl" | |
require "resolv" | |
module DNSSD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/Users/aaron/.rubies/arm64/ruby-trunk/bin/ruby | |
# Configure Vim (using vim-lsp) like this where `ls.rb` is this script: | |
# | |
# if executable('./ls.rb') | |
# au User lsp_setup call lsp#register_server({ | |
# \ 'name': 'ls.rb', | |
# \ 'cmd': ['./ls.rb'], | |
# \ 'allowlist': ['ruby'], | |
# \ }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "strscan" | |
class Lexer | |
IDENTIFIER = /[_A-Za-z][_0-9A-Za-z]*\b/ | |
IGNORE = %r{ | |
(?: | |
[, \c\r\n\t]+ | | |
\#.*$ | |
)* | |
}x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
profiler = Thread.new do | |
while true | |
p Thread.main.backtrace | |
sleep 0.5 | |
end | |
end | |
def slow_function | |
sleep 2 | |
end |
NewerOlder