bakkdoor / fancy

Fancy is a dynamic, object-oriented programming language inspired by Smalltalk, Ruby, Io and Erlang that runs on the Rubinius VM.
http://www.fancy-lang.org
BSD 3-Clause "New" or "Revised" License
261 stars 22 forks source link

Bytecode implementation of Array#[] #75

Closed dirk closed 11 years ago

dirk commented 11 years ago

Essentially an implementation of the match condition in tighter bytecode. Casual performance tests show the speed boost can be as much as twice as fast for esoteric, []-call-heavy programs.

This is also fixes a bug in Object#fancy_methods since Symbols currently don't have an includes?: method.

dirk commented 11 years ago

@bakkdoor Since it looks like a lot of performance gains can be made by implementing bytecode versions of some hot methods, what do you think about leaving the original method definitions in the main class file (eg. lib/array.fy) and then overwriting them in the VM with dynamic_method calls in some explicitly-bytecode-assembly file (eg. lib/bytecode/array.fy)? This way the original definition and documentation would be in the nice uncluttered main library file, and then the fast semantically-identical version would be in the ugly bytecodes file.

bakkdoor commented 11 years ago

@dirk I like that idea. I think we should do it that way. It makes for easy documentation and letting people find the high-level definition of a method (if they want to look up how it works) but gives us good performance.

dirk commented 11 years ago

Okay cool. Will have that commit in here in a bit.