*FINALLY!*

Okay, so when setting, config.assets.compress = true, this uses a 
JavaScript (V8) runtime, right?
Somewhere in the compressor, your whole Rails app is being loaded 
(multiple times!). In my case, this include features/**/*.rb
These Ruby files have some references to the constant Capybara. Because 
I don't have the Capybara gem available on my server (it's in the 'test' 
group in Gemfile), Rails will be doing its magic constant missing 
trickery, which is crazy expensive.
This brought the total time to run the 'rake assets:precompile' task to 
20 minutes! I could reproduce it locally by removing the Capybara gem 
from my Gemfile.

I really hope Google will index this well, and nobody has to spend 
another full day tracing this bug.
Now let's fix this!

By the way, here is some output from the process sampler:

1 rb_gc_mark  (in ruby) + 55  [0x100039d47]
    1457 Thread_33491: SamplerThread
      1457 thread_start  (in libsystem_c.dylib) + 13  [0x7fff8bdf8b75]
        1457 _pthread_start  (in libsystem_c.dylib) + 335 
[0x7fff8bdf58bf]
          1457 _ZN2v88internalL11ThreadEntryEPv  (in v8.bundle) + 85 
[0x102dd4d75]
            1457 v8::internal::SamplerThread::Run()  (in v8.bundle) + 55 
[0x102dd55c7]
              1457 
v8::internal::RuntimeProfilerRateLimiter::SuspendIfNecessary()  (in 
v8.bundle) + 120  [0x102dedbc8]
                1457 semaphore_wait_trap  (in libsystem_kernel.dylib) + 
10  [0x7fff8d2f96b6]

Total number in stack (recursive counted multiple, when >=5):
        27300       rb_gc_mark  (in ruby) + 190  [0x100039dce]
        12110       st_foreach  (in ruby) + 98  [0x1000878a2]
        11346       mark_entry  (in ruby) + 12  [0x100039eec]
        5576       gc_mark_children  (in ruby) + 124  [0x10003959c]
        5312       gc_mark_children  (in ruby) + 1778  [0x100039c12]
        5181       gc_mark_children  (in ruby) + 1524  [0x100039b14]
        4558       gc_mark_children  (in ruby) + 1769  [0x100039c09]
        4017       rb_call  (in ruby) + 188  [0x1000237ac]
        3100       rb_call0  (in ruby) + 3267  [0x1000233c3]
        2648       eval_call  (in ruby) + 347  [0x10002d95b]
        2186       gc_mark_children  (in ruby) + 1386  [0x100039a8a]
        1461       rb_eval  (in ruby) + 525  [0x10001e95d]
        1257       rb_yield_0  (in ruby) + 1135  [0x10002174f]
        1014       eval_iter  (in ruby) + 1029  [0x10002e1c5]
        1010       eval_fcall  (in ruby) + 330  [0x10002d69a]
        926       rb_call0  (in ruby) + 3436  [0x10002346c]
        775       gc_mark_children  (in ruby) + 1796  [0x100039c24]
        748       mark_keyvalue  (in ruby) + 25  [0x100039ec9]
        496       blk_mark  (in ruby) + 50  [0x100017622]
        495       gc_mark_children  (in ruby) + 1993  [0x100039ce9]
        480       rb_ary_each  (in ruby) + 46  [0x1000015ce]
        430       rb_eval  (in ruby) + 1464  [0x10001ed08]
        381       gc_mark_children  (in ruby) + 1539  [0x100039b23]
        357       blk_mark  (in ruby) + 76  [0x10001763c]
        357       rb_eval  (in ruby) + 3331  [0x10001f453]
        335       gc_mark_children  (in ruby) + 0  [0x100039520]
        294       rb_gc_mark  (in ruby) + 0  [0x100039d10]
        293       eval_call  (in ruby) + 461  [0x10002d9cd]
        274       eval_rescue  (in ruby) + 311  [0x100024b87]
        273       rb_eval  (in ruby) + 853  [0x10001eaa5]
        272       proc_invoke  (in ruby) + 1181  [0x1000224fd]
        270       gc_mark_children  (in ruby) + 1515  [0x100039b0b]
        264       block_pass  (in ruby) + 868  [0x100029494]
        254       eval_call  (in ruby) + 114  [0x10002d872]
        253       blk_mark  (in ruby) + 97  [0x100017651]
        174       eval_while  (in ruby) + 268  [0x1000207fc]
        174       garbage_collect  (in ruby) + 79  [0x10003b00f]
        174       garbage_collect_0  (in ruby) + 200  [0x10003a138]
        174       rb_str_resize  (in ruby) + 94  [0x10008e00e]
        174       ruby_xrealloc  (in ruby) + 215  [0x10003b9c7]
        174       strio_extend  (in stringio.bundle) + 60  [0x1001f190c] 
stringio.c:757
        174       strio_putc  (in stringio.bundle) + 184  [0x1001f2cb8] 
stringio.c:1135
        166       rb_eval  (in ruby) + 1901  [0x10001eebd]
        165       eval_slit  (in ruby) + 81  [0x100024cb1]
        165       rb_eval  (in ruby) + 1987  [0x10001ef13]
        143       rb_eval  (in ruby) + 3144  [0x10001f398]
        141       rb_eval  (in ruby) + 2205  [0x10001efed]
        133       st_foreach  (in ruby) + 0  [0x100087840]
        132       rb_eval  (in ruby) + 3073  [0x10001f351]
        117       eval_attrasgn  (in ruby) + 397  [0x10002dc4d]
        99       eval_ensure  (in ruby) + 231  [0x1000204a7]
        53       gc_mark_children  (in ruby) + 642  [0x1000397a2]
        49       rb_mark_generic_ivar  (in ruby) + 57  [0x100099639]
        37       rb_fast_mark_table_contains  (in ruby) + 0 
[0x100036eb0]
        31       mark_keyvalue  (in ruby) + 17  [0x100039ec1]
        28       gc_mark_children  (in ruby) + 331  [0x10003966b]
        27       gc_mark_children  (in ruby) + 1556  [0x100039b34]
        24       rb_gc_mark  (in ruby) + 105  [0x100039d79]
        23       mark_source_filename  (in ruby) + 0  [0x100037000]
        22       rb_fast_mark_table_add  (in ruby) + 0  [0x100036e90]
        14       blk_mark  (in ruby) + 41  [0x100017619]
        13       gc_mark_children  (in ruby) + 1473  [0x100039ae1]
        12       gc_mark_children  (in ruby) + 1486  [0x100039aee]
        11       rb_fast_mark_table_add_filename  (in ruby) + 0 
[0x100036ef0]
        10       blk_mark  (in ruby) + 121  [0x100017669]
        10       rb_gc_mark  (in ruby) + 118  [0x100039d86]
        8       rb_load  (in ruby) + 1476  [0x100030184]
        7       mark_entry  (in ruby) + 0  [0x100039ee0]
        7       rb_f_load  (in ruby) + 53  [0x1000307f5]
        5       blk_mark  (in ruby) + 0  [0x1000175f0]
        5       gc_mark_children  (in ruby) + 463  [0x1000396ef]

Sort by top of stack, same collapsed (when >= 5):
        semaphore_wait_trap  (in libsystem_kernel.dylib)        1457
        gc_mark_children  (in ruby)        399
        rb_gc_mark  (in ruby)        386
        rb_fast_mark_table_heap_contains  (in ruby)        224
        st_foreach  (in ruby)        222
        garbage_collect_0  (in ruby)        78
        rb_fast_mark_table_contains  (in ruby)        37
        mark_source_filename  (in ruby)        24
        rb_fast_mark_table_add  (in ruby)        22
        rb_fast_mark_table_heap_remove  (in ruby)        16
        rb_fast_mark_table_add_filename  (in ruby)        11
        mark_entry  (in ruby)        7
        blk_mark  (in ruby)        5
        rb_fast_mark_table_contains_filename  (in ruby)        5

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to