#424: performance regression from ruby 1.8 and 1.9 -------------------------------------+-------------------------------------- Reporter: jordan.breeding@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: -------------------------------------+-------------------------------------- Comment(by jordan.breeding@…): I can look into it more later, the ones posted above actually only require two smallish ruby files out of the lib directory from my archive, I could just paste them into the top of the other file and upload it as a new attachment if that would help in any way. In the mean time I used DTrace to get some timings for functions/methods from ruby and MacRuby ruby: {{{ 13 jordan@thetourist ~/priority_queue_bug > sudo dtrace -s ruby_method_analysis.d -c "ruby ./search.pqueue -m -c a-star input_files/input13_4.txt" Password: Target pid: 352 Step 0: bbwxbwbwbwwbw (c=0) Step 1: move 6 bbwbbwxwbwwbw (c=3) Step 2: move 5 bbwbbxwwbwwbw (c=1) Step 3: move 8 bbwbbbwwxwwbw (c=3) Step 4: move 2 bbxbbbwwwwwbw (c=6) Step 5: move 11 bbbbbbwwwwwxw (c=9) Step 6: move 6 bbbbbbxwwwwww (c=5) CLASS METHOD COUNT AVG(us) SUM(us) ----------------------------------------------------------------------------------------------------------------------- String split 3298 36 121861 IO write 16 19 307 String % 6 16 98 Exception initialize 1 16 16 JBBNodePriority initialize 3308 16 53831 Exception set_backtrace 1 15 15 Range each 3299 15 51517 String initialize_copy 42886 14 619271 Exception backtrace 1 14 14 Fixnum to_s 15 14 213 JBBNode priority 38826 14 544505 JBBNode to_s 7 13 97 Hash []= 381 13 5291 Hash include? 8629 13 117828 String index 3298 13 44610 String length 3300 13 43452 String []= 79176 13 1034814 Array push 381 13 4971 Array to_a 3299 12 42753 Array []= 18440 12 237676 Fixnum div 7236 12 93047 Fixnum <=> 5068 12 64921 String == 53172 12 679790 Array [] 87152 12 1109695 String [] 79176 12 1007480 Fixnum == 42887 12 544730 Fixnum abs 20086 12 255014 Fixnum / 9894 12 125471 Hash [] 16788 12 211988 Fixnum > 31024 12 390794 Fixnum * 21067 12 264933 Fixnum < 28374 12 355145 Fixnum - 24145 12 302109 Fixnum + 81377 12 1017731 }}} MacRuby: {{{ 14 jordan@thetourist ~/priority_queue_bug > sudo dtrace -s macruby_method_analysis.d -c "macruby ./search.pqueue -m -c a-star input_files/input13_4.txt" Target pid: 360 Step 0: bbwxbwbwbwwbw (c=0) Step 1: move 6 bbwbbwxwbwwbw (c=3) Step 2: move 5 bbwbbxwwbwwbw (c=1) Step 3: move 8 bbwbbbwwxwwbw (c=3) Step 4: move 2 bbxbbbwwwwwbw (c=6) Step 5: move 11 bbbbbbwwwwwxw (c=9) Step 6: move 6 bbbbbbxwwwwww (c=5) CLASS METHOD COUNT AVG(us) SUM(us) ----------------------------------------------------------------------------------------------------------------------- PQueue initialize 1 9068 9068 Class protected: 1 6113 6113 Revision initialize: 2 1456 2912 Class private: 11 1398 15381 OptionParser::List each_option 6 861 5167 Class attr_reader: 11 685 7541 Class gm: 1 663 663 Class include: 5 646 3231 NSMutableArray extend: 1 613 613 NSMutableArray <=>: 1 571 571 NSMutableString %: 13 550 7151 Class attr_accessor: 4 545 2180 OptionParser::OptionMap invert 14 524 7346 Enumerator to_a 3634 517 1880180 JBBNode <=>: 22168 429 9528017 Class extend_object: 3 422 1267 NSMutableArray each 3654 364 1333418 FalseClass ===: 20 345 6901 NSMutableString scan: 1 344 344 NilClass ===: 20 343 6878 TrueClass ===: 20 342 6852 Range to_a 3633 323 1176485 NSMutableDictionary update: 7 319 2239 Class attr: 1 314 314 Class attr_writer: 5 297 1488 Class new 7 289 2024 OptionParser::OptionMap []: 2 283 566 OptionParser::List __send__: 86 281 24238 NSMutableArray each_with_index 1 275 275 Class new: 3639 270 985681 NSMutableArray delete_if 7 254 1782 Proc call: 4 253 1015 Class append_features: 5 247 1236 ByteString swap!: 43596 241 10536678 Set initialize 1 199 199 OptionParser::CompletingHash []=: 7 182 1279 OptionParser::List initialize 3 148 445 Class readlines: 1 139 139 OptionParser::Switch::NoArgument initialize: 6 135 810 OptionParser::Switch::RequiredArgument initialize: 1 132 132 Class alloc 3636 124 452700 NSMutableString *: 4 121 487 Method to_proc 1 119 119 NSArray <<: 2 119 238 NSMutableString +: 2 117 234 JBBNodePriority initialize: 3632 116 423058 OptionParser::OptionMap default: 2 115 231 Class extended: 2 114 229 Proc initialize 4 114 458 OptionParser::List atype 81 114 9275 Range each 3634 114 415928 NilClass ==: 20 113 2277 Class included: 5 113 565 FalseClass ==: 20 112 2259 Class >=: 2 112 224 TrueClass ==: 20 112 2240 NilClass singleton_method_added: 1 110 110 Class method_added: 232 110 25593 Class ==: 4 110 440 NSObject singleton_method_added: 1 109 109 Proc to_proc 119 108 12946 Class inherited: 23 107 2462 OptionParser::Switch::OptionalArgument ==: 1 106 106 OptionParser::Switch::RequiredArgument ==: 12 106 1274 JBBNode to_s 7 105 738 OptionParser::Switch::NoArgument ==: 33 104 3458 Regexp ==: 6 102 617 OptionParser::List short 6 100 605 NSMutableString chars 2 94 189 Class exists?: 1 92 92 ByteString chars 7266 90 659583 ByteString strip 1 89 89 Class dirname: 1 87 87 ByteString downcase 1 81 81 NSMutableString =~: 1 70 70 JBBNode puts: 7 63 445 NSMutableArray reject 3633 59 217170 NSMutableArray method: 1 58 58 ByteString count: 3 56 169 NSMutableArray join: 1 55 55 Class lambda 5 55 275 NSMutableArray instance_eval 1 53 53 JBBSearch start_node 1 53 53 Class file?: 1 48 48 JBBNode puts 2 47 95 NSMutableArray length 2 46 93 Fixnum to_s 1 41 41 NSMutableString split: 3 40 121 PQueue lambda 1 40 40 OptionParser version=: 1 38 38 NSMutableArray at: 6 37 225 OptionParser::CompletingHash respond_to?: 2 36 72 NSMutableArray unshift: 1 35 35 Class basename: 1 34 34 NSObject include?: 1 33 33 NSMutableString downcase 8 33 267 PQueue loop 1 33 33 OptionParser banner=: 1 32 32 OptionParser::OptionMap []=: 17 32 546 NSMutableDictionary fetch: 81 31 2548 JBBNode save_path: 1 30 30 ByteString []: 87192 30 2689254 ByteString =~: 1 30 30 NSMutableArray []=: 1 29 29 Revision contents 1 29 29 NSMutableDictionary keys 20 29 587 Class incompatible_argument_styles: 1 29 29 ByteString dup 47229 29 1378244 OptionParser::OptionMap fetch: 5 29 145 NSMutableArray []: 1 28 28 NSMutableArray push: 426 28 12089 OptionParser::Switch::NoArgument block 2 28 56 Class const_set: 9 28 254 Set add: 413 27 11538 OptionParser::Switch::NoArgument conv 4 27 110 OptionParser::Switch::RequiredArgument match_nonswitch?: 2 27 55 OptionParser::Switch::NoArgument match_nonswitch?: 12 27 330 JBBNode child_for_goal 7 26 187 OptionParser::List long 3 26 79 Regexp respond_to?: 11 26 289 OptionParser top 5 26 130 OptionParser base 3 25 77 OptionParser::List list 6 25 154 NSMutableArray size 1 25 25 NSMutableDictionary freeze 1 25 25 JBBNode state 413 25 10589 OptionParser notwice: 2 25 51 NSMutableString freeze 12 25 300 OptionParser::List block_given? 9 25 225 NSMutableArray freeze 5 24 124 ByteString index: 3633 24 90215 Class pattern 6 24 148 Class proc 3 24 74 OptionParser block_given? 30 24 733 JBBNode node_cost 7 24 170 NSMutableArray empty? 8 24 194 JBBNode parent 832 24 20204 NSMutableArray shift 5 24 121 Class top 13 24 312 JBBNodePriority second_level 5258 23 126144 NSMutableString to_i 12 23 286 JBBNode expanded_children 412 23 9833 NSMutableDictionary include?: 9376 23 221179 JBBNodePriority first_level 38373 22 871790 JBBNode blank 3638 22 82600 NilClass nil? 3 22 67 ByteString []=: 87192 22 1945721 JBBNode level 4103 22 91287 JBBNode cost 7264 22 161085 Fixnum <=>: 5260 21 115443 JBBNode heuristic 3632 21 76630 JBBNode priority 40704 20 850370 Fixnum abs 22199 20 460471 Fixnum div: 7921 19 153603 }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/424#comment:5> MacRuby <http://macruby.org/>