Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The myth of dynamic language performance

Dirkjan Bussink
June 20, 2013
410

The myth of dynamic language performance

Talk at DevConTLV about how to make your dynamic language implementation faster. What are some basic techniques used and how do they work.

Dirkjan Bussink

June 20, 2013
Tweet

Transcript

  1. “PHP too slow for Facebook, builds its own faster version”

    “Everything you heard about Ruby being slow is not true. It’s about twice as slow as that” “How JavaScript is Slowing Down the Web” 2006
  2. class MethodTable def initialize @methods = {} end def store_method(name,

    code) @methods[name] = code end def find_method(name) @methods[name] end end
  3. class Address { private String street; private Integer number; private

    String city; public Address(String street, Integer number, String city) { this.street = street; this.number = number; this.city = city; } }
  4. class Address { private HashTable<String, Object> instance_variables; public Address(String street,

    Integer number, String city) { instance_variables = new HashTable<String, Object>(); instance_variables.put("street", street); instance_variables.put("number", number); instance_variables.put("city", city); } }
  5. def method1 1 + method2 end def method2 2 +

    1 end 100000.times do method1 end ... 0x110ed90e7 mov $0x9, %eax 0x110ed90ec jmp 0x119 ; 0x110ed9129 ... 0x110ed9129 addq $0xa0, %rsp 0x110ed9130 pop %rbp 0x110ed9131 ret 1 + 2 + 1 = 4 FIXNUM(4) = 0x9
  6. ?