- Identifying and explaining general concepts
- scopes, bindings, environments
- the background context behind 'running' a file/script/method
- Compiler stages:
- how they're organized and how they're chained
- how to define the first/last stages. Does the first stage have to be the parser? (I tried to implement a 'lexer' stage before then, and couldn't figure out how)
- Initializing the environment (things like initializing heap size/space) before compilation or execution
- A high-level overview of how code -> s-expressions -> AST/AST nodes -> bytecode
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 'benchmark/ips' | |
SYM = :magic_key | |
MYS = :key_magic | |
STR = 'magic_key' | |
RTS = 'key_magic' | |
Benchmark.ips do |x| | |
x.config(time: 2, warmup: 1) |
Links:
- Fusion for Free: Efficient Algebraic Effect Handlers
- Beauty in the Beast: A Functional Semantics for the Awkward Squad
- Beautiful Concurrency
- Finally Tagless, Partially Evaluated
- Data Types à la Carte
- What is an indexed monad?
- From zero to cooperating threads in 33 lines of Haskell code
- Working out the details of a type indexed free monad
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
*.rbc | |
*.pyc |
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
# Original blog post about Rubinius performance on the alioth mandelbrot benchmark: | |
# http://rfc2616.wordpress.com/2010/10/16/rubinius-vs-the-benchmark-from-hell/ | |
# | |
# Problems with assumptions in the blog post: | |
# * The C <-> Ruby comparison is apples to oranges because the Ruby code | |
# is written to use blocks rather than loops. That imposes the overhead | |
# of additional execution contexts per pixel. | |
# * The output is written a byte at a time, which requires a fairly deep | |
# chain of methods before the byte is handed off to the OS. | |
# * The work is done in the script body. Unless the implementation has |
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
def stat(args) | |
p :stat => args | |
end | |
def xtest(number) | |
p "number is: #{number}" | |
return false if number == 3 | |
return true | |
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
require "benchmark" | |
N = (ARGV.shift || 40).to_i | |
def fib(n) | |
return n if n < 2 | |
fib(n-2) + fib(n-1) | |
end | |
Benchmark.bmbm do |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
# eager loading | |
$ bin/rbx -Xint -r rubinius/analyst -e 'puts Rubinius::Analyst.new.itemized_memory' | |
Young: 6.0M | |
Mature: 10.0M | |
Large: 751.7K | |
Code: 2.9M | |
Symbols: 89.6K | |
Total: 19.7M |
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
import java.lang.invoke.MethodHandle | |
import java.lang.invoke.MethodType | |
import java.lang.invoke.CallSite | |
import java.lang.invoke.ConstantCallSite | |
import java.lang.invoke.MethodHandles::Lookup | |
JClass = java.lang.Class | |
# Our main method, which does one invokedynamic | |
main do | |
# handle for our bootstrap, which binds invokedynamic to a CallSite |
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
sasha:rubinius2.0 brian$ rbx | |
irb(main):001:0> o = Object.new | |
=> #<Object:0xf30> | |
irb(main):002:0> sc = Rubinius::Type.object_singleton_class(o) | |
=> #<Class: #<Object:3888>> | |
irb(main):003:0> module N | |
irb(main):004:1> def foo; puts 'foozee'; end | |
irb(main):005:1> end | |
=> #<Rubinius::CompiledMethod foo file=(irb)> | |
irb(main):007:0> sc.send :include, |