Skip to content

Instantly share code, notes, and snippets.

View pocke's full-sized avatar
⌨️
Pocke is typing...

Masataka Pocke Kuwabara pocke

⌨️
Pocke is typing...
View GitHub Profile

ほげaaa ほげ aaa

@pocke
pocke / README.md
Created August 20, 2018 00:45
namerror message patch
$ ruby test_before.rb # before patch
3.7357151369942585
$ ruby test.rb # after patch
1.2525334189995192

3.7357151369942585 / 1.2525334189995192 * 1000000 => 2982527.3164992435 times faster!

def log(msg)
puts "[#{Time.now}]: #{msg}"
end
log 'start'
big_str = 'a' * 500_000_000
log 'prepared'
begin
big_str.a
rescue => ex
iabbrev differentiatiations differentiations
iabbrev disproportionaltely disproportionately
iabbrev oversimplificiation oversimplification
iabbrev transcendentational transcendental
iabbrev anthromorphization anthropomorphization
iabbrev disporportionately disproportionately
iabbrev dispraportionately disproportionately
iabbrev disproportianately disproportionately
iabbrev disproportionatley disproportionately
iabbrev disproprotionately disproportionately
$ ruby-2.5.1 test.rb
"local-variable"
"local-variable"
require 'ripper'
class RipperEventViewer < Ripper::SexpBuilderPP
(Ripper::PARSER_EVENTS + Ripper::SCANNER_EVENTS).each do |ev|
eval <<~RUBY
def on_#{ev}(*args)
super.tap do
puts "#{'*'*50} on_#{ev}"
pp(*args)
end
def is_nil?(value, _=(value&.__id__(true&&return) rescue return))
return true
end
p is_nil?(nil)
p is_nil?(false)
p is_nil?(true)
class A
undef __id__
def is_nil?(value)
result = true
value&.__id__(result = false)
result
rescue
result
end
TracePoint.new(:line) do |tp|
p tp
static VALUE
str_upto_each(VALUE beg, VALUE end, int excl, int (*each)(VALUE, VALUE), VALUE arg)
{
/* (snip) */
/* normal case */
n = rb_str_cmp(beg, end);
if (n > 0 || (excl && n == 0)) return beg;
after_end = rb_funcallv(end, succ, 0, 0);
status key command
Conversion Up ConvertPrev
Composition Tab PredictAndConvert
Conversion Tab PredictAndConvert
Composition Space Convert
Conversion Space ConvertNext
Precomposition Space InsertSpace
Conversion Shift Up ConvertPrevPage
Conversion Shift Tab ConvertPrev
Composition Shift Space Convert