diff options
author | rinpatch <rinpatch@sdf.org> | 2019-09-10 22:01:45 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-09-10 22:01:45 +0300 |
commit | 43f02dfe38547e07fb189aab78539af9e02302b3 (patch) | |
tree | a7b424ab5b104aa5317f99846f7f48aa0278f12c /lib/mix/tasks/pleroma/benchmark.ex | |
parent | edbaf781763a05037c1567f6f1a3ac1d35d60de2 (diff) | |
download | pleroma-43f02dfe38547e07fb189aab78539af9e02302b3.tar.gz |
Revert "Parallelize template rendering"
This reverts commit 1ad71592adb47762287aec8c36d0fca565c38362.
Since it had no limit on the number on concurrent processes it OOM killed
instances while rendering hellthreads. When I tried introducing a
concurrency limit with Task.async_stream/manual folds it lead to about 3 times
worse performance on threads larger than 1000 activities (we are talking
30s vs 1.2 minutes), I think this is not worth the about 1.5 times
performance increase on smaller threads when using it.
Diffstat (limited to 'lib/mix/tasks/pleroma/benchmark.ex')
-rw-r--r-- | lib/mix/tasks/pleroma/benchmark.ex | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/lib/mix/tasks/pleroma/benchmark.ex b/lib/mix/tasks/pleroma/benchmark.ex index 4cc634727..a45940bf3 100644 --- a/lib/mix/tasks/pleroma/benchmark.ex +++ b/lib/mix/tasks/pleroma/benchmark.ex @@ -37,37 +37,17 @@ defmodule Mix.Tasks.Pleroma.Benchmark do |> Map.put("blocking_user", user) |> Map.put("muting_user", user) |> Map.put("user", user) - |> Map.put("limit", 80) |> Pleroma.Web.ActivityPub.ActivityPub.fetch_public_activities() |> Enum.reverse() - inputs = %{ - "One activity" => Enum.take_random(activities, 1), - "Ten activities" => Enum.take_random(activities, 10), - "Twenty activities" => Enum.take_random(activities, 20), - "Forty activities" => Enum.take_random(activities, 40), - "Eighty activities" => Enum.take_random(activities, 80) - } - - Benchee.run( - %{ - "Parallel rendering" => fn activities -> - Pleroma.Web.MastodonAPI.StatusView.render("index.json", %{ - activities: activities, - for: user, - as: :activity - }) - end, - "Standart rendering" => fn activities -> - Pleroma.Web.MastodonAPI.StatusView.render("index.json", %{ - activities: activities, - for: user, - as: :activity, - parallel: false - }) - end - }, - inputs: inputs - ) + Benchee.run(%{ + "render_timeline" => fn -> + Pleroma.Web.MastodonAPI.StatusView.render("index.json", %{ + activities: activities, + for: user, + as: :activity + }) + end + }) end end |