updating benchmarks

This commit is contained in:
Alexander Strizhakov 2020-04-24 09:24:08 +03:00
parent be34672d67
commit 1a75ef63b2
No known key found for this signature in database
GPG Key ID: 022896A53AEF1381
2 changed files with 41 additions and 46 deletions

View File

@ -313,7 +313,7 @@ defmodule Pleroma.LoadTesting.Activities do
tasks = get_reply_tasks(visibility, group) tasks = get_reply_tasks(visibility, group)
{:ok, activity} = {:ok, activity} =
CommonAPI.post(user, %{"status" => "Simple status", "visibility" => "unlisted"}) CommonAPI.post(user, %{"status" => "Simple status", "visibility" => visibility})
acc = {activity.id, ["@" <> actor.nickname, "reply to status"]} acc = {activity.id, ["@" <> actor.nickname, "reply to status"]}
insert_replies(tasks, visibility, user, friends, non_friends, acc) insert_replies(tasks, visibility, user, friends, non_friends, acc)

View File

@ -41,6 +41,7 @@ defmodule Pleroma.LoadTesting.Fetcher do
fetch_notifications(user) fetch_notifications(user)
fetch_favourites(user) fetch_favourites(user)
fetch_long_thread(user) fetch_long_thread(user)
fetch_timelines_with_reply_filtering(user)
end end
defp render_views(user) do defp render_views(user) do
@ -496,56 +497,50 @@ defmodule Pleroma.LoadTesting.Fetcher do
) )
end end
def query_replies(user) do defp fetch_timelines_with_reply_filtering(user) do
public_params = %{ public_params = opts_for_public_timeline(user)
"type" => ["Create", "Announce"],
"local_only" => false,
"blocking_user" => user,
"muting_user" => user,
"count" => 20
}
Benchee.run(%{ Benchee.run(
"Public timeline without reply filtering" => fn -> %{
ActivityPub.fetch_public_activities(public_params) "Public timeline without reply filtering" => fn ->
end, ActivityPub.fetch_public_activities(public_params)
"Public timeline with reply filtering - following" => fn -> end,
public_params "Public timeline with reply filtering - following" => fn ->
|> Map.put("reply_visibility", "following") public_params
|> Map.put("user", user) |> Map.put("reply_visibility", "following")
|> ActivityPub.fetch_public_activities() |> Map.put("user", user)
end, |> ActivityPub.fetch_public_activities()
"Public timeline with reply filtering - self" => fn -> end,
public_params "Public timeline with reply filtering - self" => fn ->
|> Map.put("reply_visibility", "self") public_params
|> Map.put("user", user) |> Map.put("reply_visibility", "self")
|> ActivityPub.fetch_public_activities() |> Map.put("user", user)
end |> ActivityPub.fetch_public_activities()
}) end
},
formatters: formatters()
)
private_params = %{ private_params = opts_for_home_timeline(user)
"type" => ["Create", "Announce"],
"blocking_user" => user,
"muting_user" => user,
"user" => user,
"count" => 20
}
recipients = [user.ap_id | User.following(user)] recipients = [user.ap_id | User.following(user)]
Benchee.run(%{ Benchee.run(
"Home timeline without reply filtering" => fn -> %{
ActivityPub.fetch_activities(recipients, private_params) "Home timeline without reply filtering" => fn ->
end, ActivityPub.fetch_activities(recipients, private_params)
"Home timeline with reply filtering - following" => fn -> end,
private_params = Map.put(private_params, "reply_visibility", "following") "Home timeline with reply filtering - following" => fn ->
private_params = Map.put(private_params, "reply_visibility", "following")
ActivityPub.fetch_activities(recipients, private_params) ActivityPub.fetch_activities(recipients, private_params)
end, end,
"Home timeline with reply filtering - self" => fn -> "Home timeline with reply filtering - self" => fn ->
private_params = Map.put(private_params, "reply_visibility", "self") private_params = Map.put(private_params, "reply_visibility", "self")
ActivityPub.fetch_activities(recipients, private_params) ActivityPub.fetch_activities(recipients, private_params)
end end
}) },
formatters: formatters()
)
end end
end end