Hi Daniel
Try the ruby profile library
http://www.rubycentral.com/book/lib_standard.html
You should be able to get this to show the time spent in each method. A
simple test should show which one is faster.
Cheers
On 4/5/06, Daniel <big@chello.se> wrote:>
> Does anybody know if there is a big performance/time cost difference
> between these two methods of serving a file:
>
> ------------------------------- #1
> -----------------------------------------
>
> send_file "test.png", :type => ''image/png'',
:disposition => ''inline''
>
>
> -------------------------------
> #2------------------------------------------
> content = ''''
> File.open("test.png", "rb") do |f|
> f.each_line { |line| content += line }
> end
> send_data content, :type => ''image/png'', :disposition
=> ''inline''
>
>
> ---------------------------------------------------------------------------
>
> Are there any other methods? Can method #2 get faster by reading the
> entire file in one sweep (as opposed to read line by line)?
>
> Thanx in advance,
> Daniel
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060405/5d810838/attachment.html