aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-08-15 00:43:02 +0300
committerrinpatch <rinpatch@sdf.org>2019-08-15 00:43:02 +0300
commita9e75fa6a4ede24fbd4549d4deb06edf368e7c52 (patch)
treebef7d1edda32f768cfa80ff3fcb5641d828f150b /lib
parent31d576de0c91019d80e465984d4423779e7ccede (diff)
downloadpleroma-a9e75fa6a4ede24fbd4549d4deb06edf368e7c52.tar.gz
Add a task to benchmark timeline rendering
Diffstat (limited to 'lib')
-rw-r--r--lib/mix/tasks/pleroma/benchmark.ex24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/mix/tasks/pleroma/benchmark.ex b/lib/mix/tasks/pleroma/benchmark.ex
index 5222cce80..a45940bf3 100644
--- a/lib/mix/tasks/pleroma/benchmark.ex
+++ b/lib/mix/tasks/pleroma/benchmark.ex
@@ -26,4 +26,28 @@ defmodule Mix.Tasks.Pleroma.Benchmark do
end
})
end
+
+ def run(["render_timeline", nickname]) do
+ start_pleroma()
+ user = Pleroma.User.get_by_nickname(nickname)
+
+ activities =
+ %{}
+ |> Map.put("type", ["Create", "Announce"])
+ |> Map.put("blocking_user", user)
+ |> Map.put("muting_user", user)
+ |> Map.put("user", user)
+ |> Pleroma.Web.ActivityPub.ActivityPub.fetch_public_activities()
+ |> Enum.reverse()
+
+ Benchee.run(%{
+ "render_timeline" => fn ->
+ Pleroma.Web.MastodonAPI.StatusView.render("index.json", %{
+ activities: activities,
+ for: user,
+ as: :activity
+ })
+ end
+ })
+ end
end