Here''s a monkey patch I put together that makes a super simple attempt
at
parallelizing the assets:precompile task: https://gist.github.com/3221581
It''s "cheating" in that this isn''t truly
parallelizing Sprockets''
compilation - it doesn''t try to go in and try to compile the
dependencies
of a manifest file before concatenation or anything. So if all you compile
in your project is application.js.coffee and application.css.scss, both of
which require a bunch of files, this may not be greatly beneficial. However
if you have a decent number of images and manifests as we do, this seems to
help significantly.
This patch depends on the truly great "parallel" gem, which wraps up
the
nastiness of dealing with Process.fork and pipes for communication. It also
seems to do a good job of auto detecting the number of cores your machine
has at its disposal. https://github.com/grosser/parallel
As is, I''m doubtful this approach would be accepted into core, but my
hope
is that this will get the conversation started. Is this approach "good
enough"? Is the dependency on the parallel gem a problem?
Would love for some other folks to give this a try and report back with
times/problems. It''s working great for us at Zaarly (I''m a
colleague of the
OP).
Brent
On Monday, July 30, 2012 10:26:23 PM UTC-4, ajsharp
wrote:>
> Has there been any discussion or development to parallelize the
> compilation of asset pipeline assets? All assets get built serially, and
> this seems like an obvious candidate for parallelization.
>
> What are the major complexities here? Has this been attempted already?
>
> I think I understand the basics of the moving parts in the compilation
> process: the ruby process has a javascript runtime available to it,
> iterates through each file in the app/assets/*.js, parses the files with
> sprockets, concatenates them and minifies them. Please correct me here if
> I''m missing anything, or have any of the details incorrect.
>
> If the core team is open to this, I''d love to discuss it further.
I know
> some of some of my colleagues and I would love to take a crack at an
> implementation.
>
> Thanks.
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-core/-/XNbn6VoYJFwJ.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.