Merge branch 'benchee' into 'develop'

Ensure benchee doesn't run unless we are executing benchmarks

See merge request pleroma/pleroma!3972
This commit is contained in:
feld 2023-11-08 18:27:08 +00:00
commit a51f3937ee
3 changed files with 16 additions and 4 deletions

View File

@ -3,8 +3,20 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.Benchmark do defmodule Mix.Tasks.Pleroma.Benchmark do
import Mix.Pleroma @shortdoc "Benchmarks"
@moduledoc """
Benchmark tasks available:
adapters
render_timeline
search
tag
MIX_ENV=benchmark mix pleroma.benchmark adapters
"""
use Mix.Task use Mix.Task
import Mix.Pleroma
def run(["search"]) do def run(["search"]) do
start_pleroma() start_pleroma()
@ -63,7 +75,7 @@ defmodule Mix.Tasks.Pleroma.Benchmark do
Benchee.run( Benchee.run(
%{ %{
"Standart rendering" => fn activities -> "Standard rendering" => fn activities ->
Pleroma.Web.MastodonAPI.StatusView.render("index.json", %{ Pleroma.Web.MastodonAPI.StatusView.render("index.json", %{
activities: activities, activities: activities,
for: user, for: user,

0
changelog.d/benchee.skip Normal file
View File

View File

@ -176,7 +176,6 @@ defmodule Pleroma.Mixfile do
{:prometheus_ecto, "~> 1.4"}, {:prometheus_ecto, "~> 1.4"},
{:recon, "~> 2.5"}, {:recon, "~> 2.5"},
{:joken, "~> 2.0"}, {:joken, "~> 2.0"},
{:benchee, "~> 1.0"},
{:pot, "~> 1.0"}, {:pot, "~> 1.0"},
{:ex_const, "~> 0.2"}, {:ex_const, "~> 0.2"},
{:plug_static_index_html, "~> 1.0.0"}, {:plug_static_index_html, "~> 1.0.0"},
@ -202,7 +201,8 @@ defmodule Pleroma.Mixfile do
{:covertool, "~> 2.0", only: :test}, {:covertool, "~> 2.0", only: :test},
{:hackney, "~> 1.18.0", override: true}, {:hackney, "~> 1.18.0", override: true},
{:mox, "~> 1.0", only: :test}, {:mox, "~> 1.0", only: :test},
{:websockex, "~> 0.4.3", only: :test} {:websockex, "~> 0.4.3", only: :test},
{:benchee, "~> 1.0", only: :benchmark}
] ++ oauth_deps() ] ++ oauth_deps()
end end