Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jacklynrose/9477642 to your computer and use it in GitHub Desktop.
Save jacklynrose/9477642 to your computer and use it in GitHub Desktop.
RubyMotion Method Definition Benchmarks

Method definition benchmarks for different versions

Using Ken Miller's benchmarking app: https://github.com/kemiller/rubymotion_benchmarking

2.20 - Take 1

                                            ObjC native loop:        0.001162
                             ObjC native loop w/objc_msgSend:        0.001512
                          ObjC method called from ruby (raw):        0.028951
                                            def method (raw):        0.035498
                                         define_method (raw):        0.075761
                                        method_missing (raw):        1.412624
                              module included in class (raw):        0.028605
                                       class_addMethod (raw):        0.039061
                          ruby method called from ObjC (raw):        0.010822

2.20 - Take 2

                                            ObjC native loop:        0.001513
                             ObjC native loop w/objc_msgSend:        0.001515
                          ObjC method called from ruby (raw):        0.034908
                                            def method (raw):        0.034111
                                         define_method (raw):        0.086868
                                        method_missing (raw):        1.611305
                              module included in class (raw):        0.128868
                                       class_addMethod (raw):        0.083887
                          ruby method called from ObjC (raw):        0.021162

2.24 - Take 1

                                            ObjC native loop:        0.000980
                             ObjC native loop w/objc_msgSend:        0.000934
                          ObjC method called from ruby (raw):        0.028435
                                            def method (raw):        0.025242
                                         define_method (raw):        0.094805
                                        method_missing (raw):        1.257411
                              module included in class (raw):        0.025348
                                       class_addMethod (raw):        0.040665
                          ruby method called from ObjC (raw):        0.009110

2.24 - Take 2

                                            ObjC native loop:        0.001045
                             ObjC native loop w/objc_msgSend:        0.001021
                          ObjC method called from ruby (raw):        0.027954
                                            def method (raw):        0.030518
                                         define_method (raw):        0.116935
                                        method_missing (raw):        1.391990
                              module included in class (raw):        0.040420
                                       class_addMethod (raw):        0.058275
                          ruby method called from ObjC (raw):        0.015830
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment