summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gleason <alex@alexgleason.me>2021-12-08 11:54:41 -0600
committerAlex Gleason <alex@alexgleason.me>2021-12-08 11:54:41 -0600
commitd194b5b7fe86196e73c5d2277862e772d54d4a5f (patch)
treec44cebce2bcd51ed2f0afc0c8f177e8863b1a01d
parent0b2119d4a791b3623b304b0bab683609d23271d4 (diff)
Benchmarks: fix user timeline and tags benchmarksbenchmark-fixes
-rw-r--r--benchmarks/mix/tasks/pleroma/benchmarks/tags.ex19
-rw-r--r--benchmarks/mix/tasks/pleroma/benchmarks/timelines.ex10
2 files changed, 15 insertions, 14 deletions
diff --git a/benchmarks/mix/tasks/pleroma/benchmarks/tags.ex b/benchmarks/mix/tasks/pleroma/benchmarks/tags.ex
index c051335a5..a32de2db4 100644
--- a/benchmarks/mix/tasks/pleroma/benchmarks/tags.ex
+++ b/benchmarks/mix/tasks/pleroma/benchmarks/tags.ex
@@ -99,15 +99,16 @@ defmodule Mix.Tasks.Pleroma.Benchmarks.Tags do
|> Enum.map(&String.downcase(&1))
_activities =
- params
- |> Map.put(:type, "Create")
- |> Map.put(:local_only, local_only)
- |> Map.put(:blocking_user, user)
- |> Map.put(:muting_user, user)
- |> Map.put(:user, user)
- |> Map.put(:tag, tags)
- |> Map.put(:tag_all, tag_all)
- |> Map.put(:tag_reject, tag_reject)
+ %{
+ type: "Create",
+ local_only: local_only,
+ blocking_user: user,
+ muting_user: user,
+ user: user,
+ tag: tags,
+ tag_all: tag_all,
+ tag_reject: tag_reject,
+ }
|> Pleroma.Web.ActivityPub.ActivityPub.fetch_public_activities()
end
end
diff --git a/benchmarks/mix/tasks/pleroma/benchmarks/timelines.ex b/benchmarks/mix/tasks/pleroma/benchmarks/timelines.ex
index aed32f194..3770ca163 100644
--- a/benchmarks/mix/tasks/pleroma/benchmarks/timelines.ex
+++ b/benchmarks/mix/tasks/pleroma/benchmarks/timelines.ex
@@ -17,14 +17,14 @@ defmodule Mix.Tasks.Pleroma.Benchmarks.Timelines do
# Let the user make 100 posts
1..100
- |> Enum.each(fn i -> CommonAPI.post(user, %{"status" => to_string(i)}) end)
+ |> Enum.each(fn i -> CommonAPI.post(user, %{status: to_string(i)}) end)
# Let 10 random users post
posts =
users
|> Enum.take_random(10)
|> Enum.map(fn {:ok, random_user} ->
- {:ok, activity} = CommonAPI.post(random_user, %{"status" => "."})
+ {:ok, activity} = CommonAPI.post(random_user, %{status: "."})
activity
end)
@@ -42,7 +42,7 @@ defmodule Mix.Tasks.Pleroma.Benchmarks.Timelines do
|> Conn.assign(:user, reading_user)
|> Conn.assign(:skip_link_headers, true)
- Pleroma.Web.MastodonAPI.AccountController.statuses(conn, %{"id" => user.id})
+ Pleroma.Web.MastodonAPI.AccountController.statuses(conn, %{id: user.id})
end
},
inputs: %{"user" => user, "no user" => nil},
@@ -50,7 +50,7 @@ defmodule Mix.Tasks.Pleroma.Benchmarks.Timelines do
)
users
- |> Enum.each(fn {:ok, follower, user} -> Pleroma.User.follow(follower, user) end)
+ |> Enum.each(fn {:ok, follower} -> Pleroma.User.follow(follower, user) end)
Benchee.run(
%{
@@ -60,7 +60,7 @@ defmodule Mix.Tasks.Pleroma.Benchmarks.Timelines do
|> Conn.assign(:user, reading_user)
|> Conn.assign(:skip_link_headers, true)
- Pleroma.Web.MastodonAPI.AccountController.statuses(conn, %{"id" => user.id})
+ Pleroma.Web.MastodonAPI.AccountController.statuses(conn, %{id: user.id})
end
},
inputs: %{"user" => user, "no user" => nil},