diff --git a/Gemfile.lock b/Gemfile.lock
index c9770a399..615f3d644 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -103,7 +103,7 @@ GEM
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.3.1)
- rack (1.4.3)
+ rack (1.4.4)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb
index bcc79cfaa..cfb623c05 100644
--- a/app/controllers/static_controller.rb
+++ b/app/controllers/static_controller.rb
@@ -1,5 +1,28 @@
class StaticController < ApplicationController
- def jquery_test
+ def benchmark
+ n = 1_000
+
+ Benchmark.bm do |x|
+ x.report("default") do
+ n.times do
+ view_context.link_to("test", :controller => "posts", :action => "index", :tags => "abc")
+ end
+ end
+
+ x.report("posts_path") do
+ n.times do
+ view_context.link_to("test", posts_path(:tags => "abc"))
+ end
+ end
+
+ x.report("fast link to") do
+ n.times do
+ view_context.fast_link_to("test", :controller => "posts", :action => "index", :tags => "abc")
+ end
+ end
+ end
+
+ render :nothing => true
end
def terms_of_service
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 6ad9dd5c1..fce5e8e63 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -9,6 +9,38 @@ module ApplicationHelper
content_tag("li", link_to(text, url, options), :class => klass)
end
+ def fast_link_to(text, link_params, options = {})
+ if options
+ attributes = options.map do |k, v|
+ %{#{k}="#{h(v)}"}
+ end.join(" ")
+ else
+ attributes = ""
+ end
+
+ if link_params.is_a?(Hash)
+ action = link_params.delete(:action)
+ controller = link_params.delete(:controller) || controller_name
+ id = link_params.delete(:id)
+
+ link_params = link_params.map {|k, v| "#{k}=#{u(v)}"}.join("&")
+
+ if link_params.present?
+ link_params = "?#{link_params}"
+ end
+
+ if id
+ url = "/#{controller}/#{action}/#{id}#{link_params}"
+ else
+ url = "/#{controller}/#{action}#{link_params}"
+ end
+ else
+ url = link_params
+ end
+
+ raw %{#{text}}
+ end
+
def format_text(text, options = {})
DText.parse(text)
end
diff --git a/app/views/comments/partials/index/_threshold.html.erb b/app/views/comments/partials/index/_threshold.html.erb
index 5b02e190d..449a7ab96 100644
--- a/app/views/comments/partials/index/_threshold.html.erb
+++ b/app/views/comments/partials/index/_threshold.html.erb
@@ -1,3 +1,3 @@
<% if post.hidden_comment_count(@current_user) > 0 %>
- <%= link_to_remote "#{pluralize post.hidden_comment_count(@current_user), 'comment'} below threshold", :url => {:controller => "comment", :action => "index_all", :post_id => post.id} %>.
+ <%= link_to_remote "#{pluralize post.hidden_comment_count(@current_user), 'comment'} below threshold", :url => index_all_comments_path(:post_id => post.id) %>.
<% end %>
diff --git a/app/views/notes/_note.html.erb b/app/views/notes/_note.html.erb
index a4972c3fb..4d4f860c7 100644
--- a/app/views/notes/_note.html.erb
+++ b/app/views/notes/_note.html.erb
@@ -1 +1,3 @@
-<%= content_tag(:article, raw(DText.sanitize(note.body)), "data-width" => note.width, "data-height" => note.height, "data-x" => note.x, "data-y" => note.y, "data-id" => note.id) %>
+History
-