95 Commits

Author SHA1 Message Date
Jesse Yurkovich
024f396d06 Cleanup: Fix typos in tests subdirectory
Fixes various typos

Co-authored-by: luz paz
Pull Request: https://projects.blender.org/blender/blender/pulls/148090
2025-10-14 22:35:54 +02:00
Ray Molenkamp
7ec48a6ed1 Benchmark: allow exclusion filters using !
This allows exclusions to be set in the `tests` filter for the
benchmarks using the exclamation mark. Exclusions apply *after*
inclusions ie:

tests = ['*', '!victor', '!koro']

would select all available tests then specifically exclude victor
and koro, while:

tests = ['!victor']

would just exclude victor, since nothing is marked for inclusion
no tests will be run.

tests = ['!victor','bmw27,'victor']

would exclude victor, but include bmw27 and victor but as victor was
marked for exclusion only bmw27 will be ran.

Requested by bart in #146019

Pull Request: https://projects.blender.org/blender/blender/pulls/147588
2025-10-09 10:46:25 +02:00
Campbell Barton
705c868bb9 Cleanup: trailing space 2025-09-23 09:37:03 +10:00
Namit Bhutani
2110391058 PyAPI: rename undo memory usage method, improve doc-string
Ref !146095
2025-09-12 22:05:53 +10:00
Namit Bhutani
8536fd1223 Sculpt: Compress position undo step data
Stored undo step data for position changes in sculpt mode are now
automatically compressed. Compression is run in background threads,
reducing memory consumption during sculpting sessions while adding
little performance overhead.

For testing and benchmarks, memory usage is now available through
`bpy.app.undo_memory_info()`. Undo memory usage is now tracked by the
existing automated benchmark tests. Some changes to the web benchmark
visualization present the data a bit better.

ZSTD compression is run asynchronously in a backround task pool.
Compression is only blocking if the data is requested immediately for
undo/redo.

Co-authored-by: Hans Goudey <hans@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/141310
2025-09-03 19:15:05 +02:00
Bastien Montagne
469f54f484 BPY: Implement get_transform and set_transform for runtime-defined RNA properties.
Improve handling of runtime defined python RNA properties. Mainly:
* Add `get_transform` and `set_transform` new callbacks.
  These allow to edit the value, while still using the default
  (IDProperty-based) storage system.
* Read-only properties should now be defined using a new `options` flag,
  `READ_ONLY`.
* `get`/`set` should only be used when storing data outside of the
  default system now.
  * Having a `get` without a `set` defined forces property to be
    read-only (same behavior as before).
  * Having a `set` without a `get` is now an error.
* Just like with existing `get/set` callbacks, `get_/set_transform`
  callbacks must always generate values matching the constraints defined
  by their `bpy.props` property definition (same type, within required
  range, same dimensions/sizes for the `Vector` properties, etc.).
* To simplify handling of non-statically sized strings, the relevant
  RNA API has been modified, to use `std::string` instead of
  (allocated) char arrays.

Relevant unittests and benchmarking have been added or updated as part
of this project.

Note: From initial benchmarking, 'transform' versions of get/set are
several times faster than 'real' get/set.

Implements #141042.

Pull Request: https://projects.blender.org/blender/blender/pulls/141303
2025-09-02 11:30:09 +02:00
Christoph Neuhauser
1e523e2f5d Fix #143653: Add use of Quality of Service (QoS) API on Windows
This PR adds code for setting the Quality of Service (QoS) level of the
process on Windows. This can, e.g., make sure that on hybrid systems
P-cores are utilized even when the app window is out of focus.

In the following cases, it is adjusted from the default behavior:
- In wm_jobs.cc the QoS level is raised while a priority job is running.
- The command line option `--qos [high|eco|default]` can be used to
  change the QoS level of the process.
- By default, the QoS level is raised for the EEVEE performance tests,
  as they check viewport rendering performance and would otherwise be
  reliant on never going out of focus to not get a downgraded QoS level.
  By default, they are created with an out of focus window at the time
  of landing this PR. This PR makes sure that they actually measure the
  animation replay performance attainable during real-world use.

Pull Request: https://projects.blender.org/blender/blender/pulls/144224
2025-09-01 11:19:17 +02:00
Bastien Montagne
9df3b1cd06 Benchmark: Fix bpy/RNA broken 'bpy props get/set' tests, add FloatVectorProperty one.
Not sure why it did not error with the other bpy prop types... It did
was slowing things a lot though, get/set logic was failry broken.
2025-08-20 16:37:52 +02:00
Christoph Neuhauser
7c7af11b9b Tests: Turn VSync off for performance tests
To avoid timings being capped at the display refresh rate.

Ref #143049

Pull Request: https://projects.blender.org/blender/blender/pulls/144555
2025-08-14 16:39:29 +02:00
Bastien Montagne
9be8f3d430 Benchmark: Improve RNA performance tests flexibility.
Make registered py-defined property tests more flexible, by allowing to
pass the property type as an argument.

And add basic such tests for Bool and String types.
2025-08-12 20:11:11 +02:00
Christoph Neuhauser
d256cce766 Tests: Overwrite animation FPS limit in EEVEE performance tests
This PR overwrites the FPS limit in the EEVEE performance tests to 1000 FPS.

Background: I have been using the performance tests with, e.g., the Temple scene from the Blender demo files. However, it has configured an animation playback frame rate of 25 FPS. I think for the performance tests it would be more meaningful to render at an unlimited frame rate. Otherwise, one can just see that Temple renders at 25 FPS on pretty much any GPU and it is not possible to measure performance improvements or regressions.

Pull Request: https://projects.blender.org/blender/blender/pulls/142984
2025-08-11 12:07:29 +02:00
Habib Gahbiche
8d078be86b Benchmark: Compositor support
Extend the existing benchmark framework to support the compositor.
Files are added separately.

Example output:
```
$ ./benchmark.py run comp
                                         4.5                  main
ghosts                                   1.2055s              1.0243s
ghosts                                   1.4936s              1.0454s
ghosts                                   0.4414s              0.4330s

file:///Users/habib/blender-git/benchmark/comp/results.html
```

Pull Request: https://projects.blender.org/blender/blender/pulls/136600
2025-08-08 14:28:21 +02:00
Bastien Montagne
f453c189f8 make format 2025-08-05 11:02:21 +02:00
Bastien Montagne
d3f6523536 tests: Add basic performance test for bpy/RNA API.
These tests check performances of ID python wrapper creation (these are
cached), regular RNA struct wrapper creation, acess to IDProperties,
(un)registering of py-defined PropertyGroup, and access to py-defined
properties (without and without custom get/set).

The goal of these tests is mainly to follow performances impact of
on-going refactors and improvements in the BPY/RNA area.
2025-08-05 10:41:08 +02:00
Christoph Neuhauser
a5043308f2 Fix: Tests: Avoid RecursionError in EEVEE performance tests
The EEVEE performance tests call scene.frame_set at the end of the warmup stage, which recursively
calls frame_change_handler. Eventually, this leads to a RecursionError. This PR adds a guard for
checking if frame_set is currently active and returns early for this recursive call of the function.

Pull Request: https://projects.blender.org/blender/blender/pulls/143203
2025-08-04 08:54:10 +02:00
Christoph Neuhauser
0cce8536dc Fix: Tests: Two-stage shader compilation in EEVEE performance tests
The EEVEE performance tests wait for shader compilation to finish before
beginning to record performance. However, shader compilation can also
happen after the first frame. This PR adds a check to the warmup phase
to see if shader compilation is still happening. This happens, e.g., for
the Mr. Elephant demo scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/143690
2025-08-01 18:35:27 +02:00
Brecht Van Lommel
eb8dc8f535 Fix: Operator, app template and benchmarking script errors after media type
Always set the media type before the file format.

Ref #142955

Pull Request: https://projects.blender.org/blender/blender/pulls/143433
2025-07-28 11:55:11 +02:00
Christoph Neuhauser
6cf0adc06a Tests: Add minimum number of frames tested in EEVEE performance tests
This commit adds a minimum number of frames tested in the EEVEE
performance tests (`tests/performance/tests/eevee.py`). This way,
test results are more reliable for .blend files with a low number of
animation frames.

Pull Request: https://projects.blender.org/blender/blender/pulls/141290
2025-07-07 17:22:29 +02:00
Namit Bhutani
e5db240434 Mesh: Spatial Reordering for Sculpt Speed Improvements
**Problem Description**

Blender's current mesh data layout often lacks spatial coherence,
causing performance bottlenecks during BVH construction for sculpting
and painting operations. Each time a BVH is built, the system must
recompute spatial partitioning and vertex groupings from scratch,
leading to redundant calculations and suboptimal memory access patterns.

**Proposed Solution**

This patch implements pre-computed spatial organization of mesh data
through a new `mesh_apply_spatial_organization()` function that:

- Reorders vertices and faces based on spatial locality using recursive
  spatial partitioning.
- Stores pre-computed MeshGroup hierarchies in MeshRuntime for reuse.
- Enables the BVH system to bypass expensive spatial computation when
  pre-organized data is available.

This approach separates the expensive spatial computation from more
frequent BVH rebuilds, providing sustained performance improvements
across multiple sculpting operations.

**Limitations**

- Requires manual invocation (occurs automatically only during remesh
  operations).
- Additional memory overhead for storing MeshGroup metadata.
- One-time computational cost during initial organization.
- Spatial group references are not yet stored in files.

**User Interface**

The feature is accessible via a new "Reorder Mesh Spatially" operator in
the Mesh Data Properties panel under the Geometry Data section. Users
can invoke it manually when needed, or it will be applied automatically
during quadriflow and voxel remesh operations. The operator provides
feedback confirming successful spatial reordering.

Pull Request: https://projects.blender.org/blender/blender/pulls/139536
2025-07-04 20:02:37 +02:00
Sean Kim
1278088aee Merge branch 'blender-v4.5-release' 2025-07-01 09:40:50 -07:00
Sean Kim
5b89f6d973 Tests: Add multires subdivision performance test
Add performance test for subdividing a multiresolution mesh from level
2 to 3. This test ends with a total fine vertex count of approximately
10m, similar to the stroke and BVH tests for multires.

Pull Request: https://projects.blender.org/blender/blender/pulls/141168
2025-07-01 18:40:21 +02:00
Bastien Montagne
8d04546fb7 Benchmark Tests: improve error reporting.
When a benchmark test was failing, there was very little info available
to investigate it. Now report the stdout/stderr generated by the failing
command.
2025-06-24 18:54:55 +02:00
Sean Kim
339abe76d0 Tests: Reset sculpt performance test state between every run
Prior to this commit, the sculpt scene and object was only initialized
once, at the very beginning of the test. This has the downside of slowly
changing the performance characteristics as more and more strokes are
performed, as the number of vertices within a given stroke may
eventually approach 1. To ensure a consistent measurement each time,
rebuild the scene between each brush stroke.

Pull Request: https://projects.blender.org/blender/blender/pulls/139960
2025-06-11 05:06:44 +02:00
Sean Kim
c8d0e76ebd Tests: Lower Sculpt Dyntopo mesh size to 250000 in performance test
This commit lowers the size of the mesh from approximately 2 million
verts to 250 thousand verts. This brings the graph more in line with the
mesh and multires usecase, and is more helpful in measuring and
detecting real performance issues.

While the upper end of dyntopo can certainly be massively improved,
strokes that take in the seconds to complete are already unusable from a
user perspective,
2025-06-11 05:06:43 +02:00
Sean Kim
24f6719d00 Tests: Add sculpt rebuild bvh performance tests
Using the same sized grids as the brush tests, this commit uses the
`sculpt.optimize` operator to approximate the cost of rebuilding the BVH
for a given base mesh grid, multires grid, and dyntopo grid.

Pull Request: https://projects.blender.org/blender/blender/pulls/137690
2025-04-18 06:08:41 +02:00
Sean Kim
8b7b9380a7 Fix: Sculpt performance test doesn't run
Incomplete fix in ed91a298c0

`StrEnum` is also a concept that doesn't exist in python 3.9

Pull Request: https://projects.blender.org/blender/blender/pulls/137624
2025-04-16 23:08:45 +02:00
Sean Kim
ed91a298c0 Fix: Sculpt performance test does not run
The runner for the performance tests / benchmarks uses python 3.9, so
the `match` statement is invalid as a concept.

Pull Request: https://projects.blender.org/blender/blender/pulls/137563
2025-04-15 23:16:24 +02:00
Sean Kim
5cacb7cedd Tests: Overhaul Sculpt performance tests
This commit makes a number of changes to the sculpt performance tests,
aimed at measuring more consistent data and making it easier to extend
the test cases.

* Repeats tests a minimum of 5 times up to 100 times, with a timeout
  of 5 seconds for a given test case to run, averaging the duration of
  the brush strokes to stabilize the value
* Sets the brush from the script instead of having it defined in each
  file, preventing the need to duplicate benchmark files.
* Uses the newly defined `override_location` property to allow defining
  the stroke in screen-space and repeating strokes multiple times
  without regenerating the base mesh
* Adds tests for the smooth brush, as basic neighbor calculations
* Adds tests for dyntopo sculpting
* Renames the base mesh tests to have a "mesh_" prefix as the data is
  inherently discontinuous here.

Related benchmark PR: blender/blender-benchmarks#2

Part of #133926

Pull Request: https://projects.blender.org/blender/blender/pulls/133841
2025-04-11 05:26:25 +02:00
Alaska
7a47762c20 Benchmark: Enable OSL in Cycles performance benchmark tool
This commit gives users of the Cycles performance benchmark tool the
option to run performance benchmarks with OSL enabled for CPUs
and OptiX devices.

This can be done by adding `-OSL` to the device name:
`CPU-OSL`
`OPTIX-OSL_0`

Pull Request: https://projects.blender.org/blender/blender/pulls/136506
2025-03-26 23:52:14 +01:00
Sergey Sharybin
60ca0742cb Benchmark: Support running benchmark with HW RT enabled
Similar to the regression tests it is possible to append -RT suffix
to the compute type to enable hardware ray-tracing.

For example HIP_0 will run benchmark on first HIP device without
hardware ray-tracing, HIP-RT_0 will run benchmark on the same device
but will enable hardware ray-tracing.

The downside of this change is that it will make it so METAL device
will no longer use HW-RT on M3 and aboce, and explicit METAL-RT is
to be used. This is because benchmark was relying on the Auto
configuration which has different behavior depending on the device
generation.

Pull Request: https://projects.blender.org/blender/blender/pulls/136308
2025-03-24 15:47:42 +01:00
Brecht Van Lommel
9135929063 Tests: Add back missing memory / time title in benchmark html
Pull Request: https://projects.blender.org/blender/blender/pulls/133763
2025-01-29 13:55:29 +01:00
Iliya Katueshenock
f16127a356 Tests: Add scroll to view long benchmark graph legend
Pull Request: https://projects.blender.org/blender/blender/pulls/128339
2025-01-26 08:54:44 +01:00
Iliya Katueshenock
ea7d97ae48 Tests: Avoid error in performance tests with lite build
There is no Cycles add-on in a lite build.

Pull Request: https://projects.blender.org/blender/blender/pulls/120442
2025-01-25 21:12:45 +01:00
Brecht Van Lommel
04298a0c48 Tests: Use tabs in benchmark charts
For easier overview, and to make this heavy page a bit easier to browse.

Pull Request: https://projects.blender.org/blender/blender/pulls/133385
2025-01-21 18:01:42 +01:00
Campbell Barton
abd933d6b0 Cleanup: prefer parenthesis over line continuations in Python scripts 2025-01-21 23:30:55 +11:00
Sean Kim
e2d6517109 Sculpt: Allow running performance test in 4.3 releases
Unfortunately, the tests as they are right now will likely not work with
4.2 and previous versions, as the brush asset changes will need to be
accounted for.

Pull Request: https://projects.blender.org/blender/blender/pulls/132827
2025-01-09 19:27:20 +01:00
Sean Kim
a3f523fd61 Sculpt: Add multires version of current performance benchmarks
This commit modifies the `performance/api/sculpt.py` test to add a new
set of tests that run with the multires modifier present. New tests
have `multires_` prepended to the brush name to group them separately
from the existing mesh tests.

Part of #130772

Pull Request: https://projects.blender.org/blender/blender/pulls/132822
2025-01-08 21:32:57 +01:00
Sean Kim
56128cdf9a Cleanup: Add developer docs link in benchmark.py for more information
Pull Request: https://projects.blender.org/blender/blender/pulls/132814
2025-01-08 20:35:51 +01:00
Hans Goudey
5d67f1eceb Fix: Broken sculpt performance tests after "pen_flip" removal
Caused by 6df437be5f
2024-11-07 09:15:05 +01:00
Hans Goudey
543132497c Tests: Add info to "benchmark directory not initialized" error message 2024-11-05 12:10:11 +01:00
Campbell Barton
d920ef5425 Merge branch 'blender-v4.3-release' 2024-11-03 22:04:44 +11:00
Campbell Barton
b00550916c PyDoc: correct use of single back-ticks 2024-11-03 21:50:33 +11:00
Campbell Barton
a0453ab87a Cleanup: update use of typing in for Python scripts 2024-10-23 12:48:09 +11:00
Campbell Barton
b4d5c6eea5 Cleanup: remove unused imports 2024-07-26 10:26:11 +10:00
Hans Goudey
bec350ba6e Tests: Simple automated sculpt brush stroke performance test
As an initial step to creating automated regression tests for sculpt brushes,
make our existing performance test script into an automated performance
test. The test uses the brush active in each file and runs the brush stroke
operator on a large generated grid. The time is just for the brush evaluation,
it doesn't include building the PBVH, drawing, etc.

I'm not sure about the consequences of conditionally disabling
`view3d_operator_needs_opengl`, but it was needed to make the test
work in background mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/123148
2024-07-01 16:12:02 +02:00
Brecht Van Lommel
fe4c28f2dc Fix: Benchmarks auto build not working with new lib directories
Symlinking the lib folder doesn't work anymore with submodules.
2024-06-06 19:52:55 +02:00
Campbell Barton
4f8db2ee67 Cleanup: use static sets for contains checks, remove f-string use 2024-02-28 11:02:49 +11:00
Sergey Sharybin
396348eea9 Merge branch 'blender-v4.1-release' 2024-02-22 13:51:48 +01:00
Sergey Sharybin
3dc832a904 Switch SVN to Git submodules using Git-LFS
This change makes it so build system and update utilities for Blender builds
are using pre-compiled libraries and other resources attached as Git modules
instead of using checkout of SVN repositories in the parent folder.

The directory layout:
```
  * release/datafiles/
    * assets/        -> blender-assets.git
      * publish/
      * ...
      * README.txt
  * lib/
    * darwin_x64/    -> lib-darwin_x64.git
    * darwin_arm64/  -> lib-darwin_arm64.git
    * linux_x64/     -> lib-linux_x64.git
    * windows_x64/   -> lib-windows_x64.git
  * tests/
    * data/         -> blender-test-data.git
```

The changes about configuring the actual Git sub-modules are not included
into this patch, as those require repository to actually exist before it
can be used.

The assets submodule is enabled by default, and the rest of them are
disabled. This means that if someone runs `git submodule update --init`
they will not get heavy libraries. The platform-specific and tests
related submodules are enabled when using `make update` or `make test`.

All the submodules are tracked: this means that when new commits are
done to the submodule, the blender.git repository is to be updated to
point them to the new hash. This causes some extra manual work, but it
allows to more easily update Blender and its dependencies to known good
state when performing operations like bisect.

Ref #108978

Pull Request: https://projects.blender.org/blender/blender/pulls/117946
2024-02-22 13:50:55 +01:00
Brecht Van Lommel
0f2064bc3b Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was 4bf6a2e564.
2024-02-19 15:59:59 +01:00