About Me

My photo
Software Engineer at Starburst. Maintainer at Trino. Previously at LINE, Teradata, HPE.

2017-09-20

RubyKaigi 2017


Followings are my personal memo, so sorry about the dirty and lack of sentence. Even if there’s less memo, it doesn’t mean the talk’s quality is low. I just concentrated on listening the talk.

Day1

Matz team. (are only Matz and Nobu)
Daily: Debugging, New features, Bug making etc
Why not Git? Windows is not supported officially. Not enough advantage
Developers’ meeting are held once per month
How to build Ruby is configure and make
BASERUBY: pre-installed ruby. generate source files
MINIRUBY: ruby made during the build. No dynamic loading. Unable to load extension libraries.
Mimic global variables used in mkmf.rb by trace_var
Following is exactly not a bug
p = 2
p (-1.3).abs = -1.3
Demon Castle parse.y by name
Monstrous lex_state
literal symbol by intern
Refining String#intern returns no-symbol
New features in 2.5?
Such as $. 2.3
Unicode case 2.4
Approved Array #append, #prepend
Rejected neko ^..^ operator (make range), User-defined operator
Under Discussion Method extraction operator (Kernel#method -> Method instance), Rightward assignment
Wouldn’t you write New Ruby?
Ruby History
to_json
jbuilder is very slow
ActiveModel::Serializers JSON-Schema API Blueprint(apiary), OpenAPI(Swagger), RAML, JSON Hyper-Schema, bare JSON Schema
Why choose OpenAPI? It has RESTful definition than API Blueprint
OpenAPI is developed by Swagger originally. Give type into OpenAPI
Use $merge and $ref to OpenAPI porting
GraphQL is API query language like SQL, WYSIWYG, has only 1 endpoint
Ecosystem is still insufficient
BFF is the abbreviation of Backend for Frontend
5000 warmup iterations increase 5-7%
Code is available in noahgibbs/rails_ruby_bench Rails version is 4.2.6
PyCall runs in Ruby interpreter
Use pandas in Rails app
Python is a best friend of Ruby from now on!
PyCall should be a temporary way
Red Data Tools project will be a home
Apache Arrow aims to be Arrow Memory for common tools
Red Arrow is Ruby’s one for Apach Arrrow
Sutou-san (@kou) officially became a member of PMC of Apach Arrow yesterday
Jupyter Notebook also supports Ruby
Python is managed by reference counting
Some types(string, dictionary etc) are converted from python to ruby primitive type
Ruby Commiters vs the World
Method chain is left to right, but why a substituion is left? is the motivation for rightward. Use method chain (e.g. assign_to)
Matz likes Swift and Closure except for Ruby, Emacs Lisp and Stream
ActiveSupport is made for web application
Day2
RubyKaigi is the biggest ruby conference!
Talk about talent
Love of languages
First language Matz used is Basic
Matz posted about Ruby to Python mailing list
Simula (1968) first object oriented language
Created by Dr. Kristen Nygaard
Lisp (Flavors)
C3 linearization algorithm
Alias method chain vs Module#prepend
CLOS(Common List Object System) Method combination enables hook before/after/around method calls
Gorilla, Guerrilla, Monkey patching has global influence
Scoped monkey patching?
Line coverage, Branch coverage, Path coverage
C0, C1, C2 coverage
Coverage is just a measure, not a goal
SimpleCov is a wrapper for coverage.so
Method definition is counted as an execution
Concov detets temporal change of coverage
13901 is ticket
RuboCop is an industry standard solution
RubyMine can detect more errors than RuboCop
Coverage is a lie
YARV compiles code into the bytecode
JetBrains/ruby-type-inference
JIT Type Checking for Dynamic Languages (Ren, 2016)
def foo(x)
  "".bar if x
end

foo(false)
Steep check types with annotations
Editor specific library & Universal LSP Client plugin
Auto complete & Jump definition is WIP
mtsmfm/language_server-ruby
Syntax check uses ruby -wc filename.rb Auto completion uses rcodetools
Day3
Copy on Write(CoW)
memsize_of, dup
CoW Page Fault cause bad performance
Unicorn is a forking webserver which has parent and many childs
Garbage Collector affects CoW
GC Compactions means move objects to avoid OS replicate many pages
Some people said “Moving objects is impossible”
Aaron tried ‘Two Finger Compaction’
Disadvantages slow
Advantage easy
Object Movement uses two finger. One is Free Pointer the other is Scan Pointer
Free Pointer detect free address, Scan Pointer detect used address until the two finger meet
What objects can move?
Everything!?
GC can knows ruby’s reference easily
If reference is C extension, it’s difficult
hash_key uses memory address: fix cache hash key
rb_gc_mark Dual References: fix Call rb_gc_mark, or use only ruby
rb_define_class
string literals It seems like nothing can move, but most can be fixed
46% can move!
ObjectSpace.dump_all can output as json
tenderlove/heap-utils
/proc/{PID}/smaps
Question your assumptions
Replication with Quoram
Create 2 replica of data at least (max 3). IF first response is ok, discard a thread for another node
Bigdam: Edge locations on the earch + the Central location
Bigdam-pool: Distributed key-value storage. to build S3 free data ingestion pipeline
chunk id guarantees the uniqueness
Ruby 2.5 supports block-wide rescue

JRuby’s Startup Warmup phase is slower than MRI
Have to lead tons of java classes
Warmup phase has JRuby(Ruby Interpret, Ruby JIT) & JVM(Java Interpret, Java JIT)
Graal is new JIT for all languages on the JVM
jruby/jruby
RTL
In special case, when GCC optimize simple loop, the byte code doesn’t have loop, but JVM cannot do this
MJIT status
* Unstable, doesn’ work on Windows, one more year to mature
* No inlining yet(most important optimizations!), Use C inlining, new GCC/LLVM extension
* Will RTL and MJIT be a part of MRI?
References
Slides

This is my first RubyKaigi but really interesting. Especially, Aaron’s talk left an impression on me. Of course Matz’s talk is also. Until this conference, I simply liked writing Ruby, but now I like Ruby and the community. (Uh, sounds like a poem) Matsuda-san announced that the next RubyKaigi is held in Sendai, Miyagi (June 31st - July 2nd). I will definitely go again next year!


Atomic-Bomb Dome

Peace Memorial Park

Hiroshima Castle