updating benchmarks
authorAlexander Strizhakov <alex.strizhakov@gmail.com>
Fri, 24 Apr 2020 06:24:08 +0000 (09:24 +0300)
committerAlexander Strizhakov <alex.strizhakov@gmail.com>
Fri, 24 Apr 2020 12:43:54 +0000 (15:43 +0300)
benchmarks/load_testing/activities.ex
benchmarks/load_testing/fetcher.ex

index 23ee2b987cd26258b4fa58b59e7493e622965596..2b032943bc286fa57e459e68f74be41080b2d9f0 100644 (file)
@@ -313,7 +313,7 @@ defmodule Pleroma.LoadTesting.Activities do
     tasks = get_reply_tasks(visibility, group)
 
     {: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"]}
     insert_replies(tasks, visibility, user, friends, non_friends, acc)
index 3aa82b48aaa804ec82d2ff9b538077e81e9352e2..6503deb41af50f5ed5bc3a4b18f7eaa12715e762 100644 (file)
@@ -41,6 +41,7 @@ defmodule Pleroma.LoadTesting.Fetcher do
     fetch_notifications(user)
     fetch_favourites(user)
     fetch_long_thread(user)
+    fetch_timelines_with_reply_filtering(user)
   end
 
   defp render_views(user) do
@@ -496,56 +497,50 @@ defmodule Pleroma.LoadTesting.Fetcher do
     )
   end
 
-  def query_replies(user) do
-    public_params = %{
-      "type" => ["Create", "Announce"],
-      "local_only" => false,
-      "blocking_user" => user,
-      "muting_user" => user,
-      "count" => 20
-    }
+  defp fetch_timelines_with_reply_filtering(user) do
+    public_params = opts_for_public_timeline(user)
 
-    Benchee.run(%{
-      "Public timeline without reply filtering" => fn ->
-        ActivityPub.fetch_public_activities(public_params)
-      end,
-      "Public timeline with reply filtering - following" => fn ->
-        public_params
-        |> Map.put("reply_visibility", "following")
-        |> Map.put("user", user)
-        |> ActivityPub.fetch_public_activities()
-      end,
-      "Public timeline with reply filtering - self" => fn ->
-        public_params
-        |> Map.put("reply_visibility", "self")
-        |> Map.put("user", user)
-        |> ActivityPub.fetch_public_activities()
-      end
-    })
-
-    private_params = %{
-      "type" => ["Create", "Announce"],
-      "blocking_user" => user,
-      "muting_user" => user,
-      "user" => user,
-      "count" => 20
-    }
+    Benchee.run(
+      %{
+        "Public timeline without reply filtering" => fn ->
+          ActivityPub.fetch_public_activities(public_params)
+        end,
+        "Public timeline with reply filtering - following" => fn ->
+          public_params
+          |> Map.put("reply_visibility", "following")
+          |> Map.put("user", user)
+          |> ActivityPub.fetch_public_activities()
+        end,
+        "Public timeline with reply filtering - self" => fn ->
+          public_params
+          |> Map.put("reply_visibility", "self")
+          |> Map.put("user", user)
+          |> ActivityPub.fetch_public_activities()
+        end
+      },
+      formatters: formatters()
+    )
+
+    private_params = opts_for_home_timeline(user)
 
     recipients = [user.ap_id | User.following(user)]
 
-    Benchee.run(%{
-      "Home timeline without reply filtering" => fn ->
-        ActivityPub.fetch_activities(recipients, private_params)
-      end,
-      "Home timeline with reply filtering - following" => fn ->
-        private_params = Map.put(private_params, "reply_visibility", "following")
-
-        ActivityPub.fetch_activities(recipients, private_params)
-      end,
-      "Home timeline with reply filtering - self" => fn ->
-        private_params = Map.put(private_params, "reply_visibility", "self")
-        ActivityPub.fetch_activities(recipients, private_params)
-      end
-    })
+    Benchee.run(
+      %{
+        "Home timeline without reply filtering" => fn ->
+          ActivityPub.fetch_activities(recipients, private_params)
+        end,
+        "Home timeline with reply filtering - following" => fn ->
+          private_params = Map.put(private_params, "reply_visibility", "following")
+
+          ActivityPub.fetch_activities(recipients, private_params)
+        end,
+        "Home timeline with reply filtering - self" => fn ->
+          private_params = Map.put(private_params, "reply_visibility", "self")
+          ActivityPub.fetch_activities(recipients, private_params)
+        end
+      },
+      formatters: formatters()
+    )
   end
 end