Ensure benchee doesn't run unless we are executing benchmarks

This commit is contained in:
Mark Felder 2023-11-08 12:21:34 -05:00
parent 17524865e5
commit e23672d82f
3 changed files with 16 additions and 4 deletions

View File

@ -3,8 +3,20 @@
# SPDX-License-Identifier: AGPL-3.0-only
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
import Mix.Pleroma
def run(["search"]) do
start_pleroma()
@ -63,7 +75,7 @@ defmodule Mix.Tasks.Pleroma.Benchmark do
Benchee.run(
%{
"Standart rendering" => fn activities ->
"Standard rendering" => fn activities ->
Pleroma.Web.MastodonAPI.StatusView.render("index.json", %{
activities: activities,
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"},
{:recon, "~> 2.5"},
{:joken, "~> 2.0"},
{:benchee, "~> 1.0"},
{:pot, "~> 1.0"},
{:ex_const, "~> 0.2"},
{:plug_static_index_html, "~> 1.0.0"},
@ -202,7 +201,8 @@ defmodule Pleroma.Mixfile do
{:covertool, "~> 2.0", only: :test},
{:hackney, "~> 1.18.0", override: true},
{:mox, "~> 1.0", only: :test},
{:websockex, "~> 0.4.3", only: :test}
{:websockex, "~> 0.4.3", only: :test},
{:benchee, "~> 1.0", only: :benchmark}
] ++ oauth_deps()
end