Gleb Mazovetskiy
4c53e0b8af
benchmarking.md: Explain how to compare benchmarks
2 years ago
Gleb Mazovetskiy
3d716f74d3
Add dun_render_benchmark
...
Results from a single run (a bit noisy) on my machine:
```
tools/build_and_run_benchmark.py dun_render_benchmark
```
```
------------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
------------------------------------------------------------------------------------------------------------------------
DunRenderBenchmark/LeftTriangle_Solid_FullyLit 98297 ns 98282 ns 8840 items_per_second=15.1096M/s
DunRenderBenchmark/LeftTriangle_Solid_FullyDark 124727 ns 124701 ns 6973 items_per_second=11.9085M/s
DunRenderBenchmark/LeftTriangle_Solid_PartiallyLit 514869 ns 514747 ns 1700 items_per_second=2.88491M/s
DunRenderBenchmark/LeftTriangle_Transparent_FullyLit 520312 ns 520216 ns 1682 items_per_second=2.85458M/s
DunRenderBenchmark/LeftTriangle_Transparent_FullyDark 524440 ns 524331 ns 1664 items_per_second=2.83218M/s
DunRenderBenchmark/LeftTriangle_Transparent_PartiallyLit 532300 ns 532162 ns 1647 items_per_second=2.7905M/s
DunRenderBenchmark/RightTriangle_Solid_FullyLit 92387 ns 92363 ns 8840 items_per_second=16.7275M/s
DunRenderBenchmark/RightTriangle_Solid_FullyDark 85680 ns 85662 ns 9884 items_per_second=18.0361M/s
DunRenderBenchmark/RightTriangle_Solid_PartiallyLit 538347 ns 538250 ns 1626 items_per_second=2.87041M/s
DunRenderBenchmark/RightTriangle_Transparent_FullyLit 548800 ns 548760 ns 1598 items_per_second=2.81544M/s
DunRenderBenchmark/RightTriangle_Transparent_FullyDark 540450 ns 540369 ns 1620 items_per_second=2.85916M/s
DunRenderBenchmark/RightTriangle_Transparent_PartiallyLit 555061 ns 555003 ns 1575 items_per_second=2.78377M/s
DunRenderBenchmark/TransparentSquare_Solid_FullyLit 700849 ns 700751 ns 1320 items_per_second=3.68176M/s
DunRenderBenchmark/TransparentSquare_Solid_FullyDark 664927 ns 664872 ns 1389 items_per_second=3.88045M/s
DunRenderBenchmark/TransparentSquare_Solid_PartiallyLit 1131702 ns 1131559 ns 822 items_per_second=2.28004M/s
DunRenderBenchmark/TransparentSquare_Transparent_FullyLit 1022384 ns 1022267 ns 916 items_per_second=2.5238M/s
DunRenderBenchmark/TransparentSquare_Transparent_FullyDark 1023193 ns 1023057 ns 900 items_per_second=2.52185M/s
DunRenderBenchmark/TransparentSquare_Transparent_PartiallyLit 1033573 ns 1033496 ns 895 items_per_second=2.49638M/s
DunRenderBenchmark/Square_Solid_FullyLit 53532 ns 53524 ns 10000 items_per_second=30.8272M/s
DunRenderBenchmark/Square_Solid_FullyDark 41993 ns 41987 ns 19794 items_per_second=47.1573M/s
DunRenderBenchmark/Square_Solid_PartiallyLit 842772 ns 842615 ns 1108 items_per_second=1.56655M/s
DunRenderBenchmark/Square_Transparent_FullyLit 834105 ns 834026 ns 1119 items_per_second=1.58269M/s
DunRenderBenchmark/Square_Transparent_FullyDark 831912 ns 831823 ns 1122 items_per_second=1.58688M/s
DunRenderBenchmark/Square_Transparent_PartiallyLit 924638 ns 924536 ns 1010 items_per_second=1.42774M/s
DunRenderBenchmark/LeftTrapezoid_Solid_FullyLit 33728 ns 33725 ns 24962 items_per_second=18.8583M/s
DunRenderBenchmark/LeftTrapezoid_Solid_FullyDark 31088 ns 31085 ns 27444 items_per_second=20.4601M/s
DunRenderBenchmark/LeftTrapezoid_Solid_PartiallyLit 268792 ns 268768 ns 3254 items_per_second=1.97196M/s
DunRenderBenchmark/LeftTrapezoid_Transparent_FullyLit 277990 ns 277965 ns 3140 items_per_second=1.90672M/s
DunRenderBenchmark/LeftTrapezoid_Transparent_FullyDark 268952 ns 268912 ns 3250 items_per_second=1.9709M/s
DunRenderBenchmark/LeftTrapezoid_Transparent_PartiallyLit 288869 ns 288826 ns 3056 items_per_second=1.83501M/s
DunRenderBenchmark/RightTrapezoid_Solid_FullyLit 29581 ns 29576 ns 28347 items_per_second=21.0984M/s
DunRenderBenchmark/RightTrapezoid_Solid_FullyDark 25315 ns 25312 ns 32250 items_per_second=24.6523M/s
DunRenderBenchmark/RightTrapezoid_Solid_PartiallyLit 259977 ns 259960 ns 3312 items_per_second=2.0003M/s
DunRenderBenchmark/RightTrapezoid_Transparent_FullyLit 263079 ns 263056 ns 3322 items_per_second=1.97677M/s
DunRenderBenchmark/RightTrapezoid_Transparent_FullyDark 259849 ns 259824 ns 3364 items_per_second=2.00136M/s
DunRenderBenchmark/RightTrapezoid_Transparent_PartiallyLit 279623 ns 279594 ns 3127 items_per_second=1.85984M/s
```
2 years ago
Gleb Mazovetskiy
114b38da90
Fix `ReencodeDungeonCelsLeft/RightTriangle`
...
The final line wasn't encoded correctly.
Also removes unnecessary `src` increments at the end of the encoding
functions.
```
Re-encoding dungeon CELs: 1,119 frames, 738,836 bytes
Re-encoded dungeon CELs: 1,119 frames, 721,604 bytes
```
2 years ago
Gleb Mazovetskiy
31f91ac8aa
Organize gdb/llvm files a bit better
...
Also adds a README.md for gdb.
2 years ago
Gleb Mazovetskiy
451f1fd70a
Re-encode dungeon tiles to remove bloat
...
Triangles in the dungeon CEL data have two redundant 0x00 pixels every other row.
Re-encodes the dungeon CEL data to remove these pixels in order to save RAM and simplify the rendering code.
Example RAM savings:
```
VERBOSE: Re-encoding dungeon CELs: 1,119 frames, 738,836 bytes
VERBOSE: Re-encoded dungeon CELs: 1,119 frames, 722,552 bytes
```
Performance remains the same. The rendering code is now a bit simpler.
2 years ago
Gleb Mazovetskiy
a2961eafd2
scrollrt: Add `IsFloor` function
...
Makes the connection between `foliage` and floor more obvious,
see
https://github.com/diasurgical/devilutionX/pull/7327#issuecomment-2294816131 .
2 years ago
Gleb Mazovetskiy
d41c7e4221
dun_render: Optimize triangle rendering
...
A small performance improvement at the cost of ~1 KiB binary size.
1143 -> 1147 FPS on the timedemo
2 years ago
Gleb Mazovetskiy
81452d870d
Add a `StaticVector` pretty-printer for LLDB
2 years ago
Gleb Mazovetskiy
51659c827d
Only check devilutionx.mpq version if it exists
2 years ago
Gleb Mazovetskiy
cfa6529357
animationinfo_test.cpp: Add missing include
...
for std::setprecision
2 years ago
Gleb Mazovetskiy
dc2406d2b1
Further increase outline pixels to 2048
...
Follow-up to https://github.com/diasurgical/devilutionX/pull/7157
2 years ago
Gleb Mazovetskiy
7d5bef724d
Check DevilutionX version
...
This is similar to how we handle extra fonts
2 years ago
qndel
8e57785755
change log type on missing optional lua assets from error to info
2 years ago
Gleb Mazovetskiy
8681ef7ccc
Add a `StaticVector` pretty-printer for GDB
...
Previously, printing a `StaticVector` in gdb printer the size and
the raw bytes of `data_`.
Example of using this pretty-printer:
```
$ gdb -iex 'add-autoload-safe-path .' build/devilutionx
(gdb) b Source/engine/load_file.hpp:126
(gdb) run
(gdb) p files
$1 = devilution::StaticVector<devilution::AssetRef, 6> of length 5 = {{archive = 0x55555c8d7460 <devilution::diabdat_mpq>, fileNumber = 1420,
filename = "monsters\\zombie\\zombien.cl2", directHandle = 0x0}, {archive = 0x55555c8d7460 <devilution::diabdat_mpq>, fileNumber = 1421,
filename = "monsters\\zombie\\zombiew.cl2", directHandle = 0x0}, {archive = 0x55555c8d7460 <devilution::diabdat_mpq>, fileNumber = 1422,
filename = "monsters\\zombie\\zombiea.cl2", directHandle = 0x0}, {archive = 0x55555c8d7460 <devilution::diabdat_mpq>, fileNumber = 1423,
filename = "monsters\\zombie\\zombieh.cl2", directHandle = 0x0}, {archive = 0x55555c8d7460 <devilution::diabdat_mpq>, fileNumber = 1424,
filename = "monsters\\zombie\\zombied.cl2", directHandle = 0x0}}
```
The pretty-printer implements the full array printer protocol, so it
even works in IDEs.
For VS Code and CMake, add the following to your `.vscode/settings.json`:
```
"cmake.debugConfig": {
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Load StaticVector pretty-printer"
"text": "source ${workspaceFolder}/tools/gdb/pretty_printers/utils/static_vector_pp.py",
"ignoreFailures": false
}
]
}
```
2 years ago
Gleb Mazovetskiy
bb6787ccf7
Rename `MissileData` fields to match the TSV
2 years ago
Gleb Mazovetskiy
0f13d95628
Fix Missile Hit Sound
...
Follow-up to #7312
Refs #7331
2 years ago
Gleb Mazovetskiy
d3e30d1ce9
StaticVector: Add more container methods
...
This is enough to make it usable as a backing storage for a
`priority_queue`. Had it in one of my branches and figured it might come
in handy in the future.
2 years ago
Eric Robinson
cec258fd4d
Clean up StartRangeAttack() ( #7207 )
2 years ago
Eric Robinson
d54e96ed90
Optimize RespawnDeadItem() ( #7212 )
2 years ago
Gleb Mazovetskiy
5b076e20ef
Rename `DrawFloor` to `DrawFloorTile`
...
There is no reason to overload these 2.
2 years ago
Gleb Mazovetskiy
efa94307e0
Optimize lit blending with light level 0
...
We don't need to worry about the custom Hell light table here (#7166 )
because this change only affects CLX sprites, not dungeon tiles.
2 years ago
Gleb Mazovetskiy
712f0bac0b
Remove `LightTableIndex` global
...
Also removes the redundant `DrawPlayerHelper` function.
2 years ago
Gleb Mazovetskiy
356d3aaad4
CPU profiling with gperf
...
Documentation and scripts for profiling with gperf
2 years ago
Gleb Mazovetskiy
7940a10da9
clx_render: Slightly optimize `GetSkipSize`
...
This gives a very slight FPS boost.
1140 to 1143 FPS on my machine as measured by:
```bash
tools/linux_reduced_cpu_variance_run.sh tools/measure_timedemo_performance.py -n 5 --binary build-rel/devilutionx
```
2 years ago
Gleb Mazovetskiy
aecf711688
Clean up clx_decode.hpp
2 years ago
Gleb Mazovetskiy
df98042a1b
Optimize InvDrawSlotBack
...
0.4% of the timedemo profile -> 0.2%
2 years ago
Gleb Mazovetskiy
6180d3dd3d
Reduce map lookups in dvlnet
2 years ago
qndel
24f108f193
fix many typos ( #7322 )
2 years ago
Eric Robinson
75f42cc41d
Fix monster light on knockback ( #7122 )
2 years ago
Gleb Mazovetskiy
112e113201
Optimize `DoCrawl`
...
Benchmark:
```
cmake -S. -Bbuild-reld -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=ON
cmake --build build-reld --target crawl_benchmark && build-reld/crawl_benchmark
```
Before:
```
------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------
BM_Crawl/1 3.53 ns 3.53 ns 198384032
BM_Crawl/4 54.3 ns 54.2 ns 12907171
BM_Crawl/16 733 ns 732 ns 955101
BM_Crawl/20 1142 ns 1141 ns 613766
```
After:
```
------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------
BM_Crawl/1 1.36 ns 1.36 ns 453018506
BM_Crawl/4 5.59 ns 5.59 ns 124244505
BM_Crawl/16 102 ns 101 ns 6577269
BM_Crawl/20 147 ns 147 ns 4684004
```
2 years ago
Gleb Mazovetskiy
bf98d9f533
Speed up DeadItem
...
Previously, the same tiles were rechecked over and over again.
O(k^3) -> O(k^2)
This changes the visitation order but we agreed in #7215 that
we don't care.
2 years ago
Gleb Mazovetskiy
c5788e5b08
Add a CLX rendering benchmark
...
```
----------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
----------------------------------------------------------------------------
BM_RenderSmallClx 868 ns 866 ns 802315 bytes_per_second=2.04538Gi/s items_per_second=6.92446M/s
BM_RenderLargeClx 128208 ns 128032 ns 5434 bytes_per_second=716.703Mi/s items_per_second=7.81057k/s
```
2 years ago
Gleb Mazovetskiy
5917d0945e
Delete tools/cpp_format_struct_table.py
...
All of the tables are now in TSV!
2 years ago
Gleb Mazovetskiy
91306d8c22
Migrate misdat.cpp data to TSV
2 years ago
Gleb Mazovetskiy
624afafe58
Extract Crawl to a library
...
Also adds a test and a benchmark
2 years ago
Gleb Mazovetskiy
4aa9d37f0f
Add google-benchmark
2 years ago
Gleb Mazovetskiy
e5c628db78
Add a test for Crawl order
2 years ago
Gleb Mazovetskiy
df3d76c3c1
Add utils/string_view_hash.hpp
2 years ago
Gleb Mazovetskiy
89b854491f
uwp-project/devilutionx.vcxproj: Add 3rdParty/unordered_dense
2 years ago
Gleb Mazovetskiy
78e87e9f09
clx_sprite: Minor improvements from #7191
2 years ago
Gleb Mazovetskiy
90732aa7be
Migrate objdat.cpp data to TSV
2 years ago
Gleb Mazovetskiy
e5e007cd3c
Slightly optimize `Utf8CodePointLen`
...
A few more operations but the "lookup table" is now an immediate constant.
https://godbolt.org/z/7YG3ohWT6
2 years ago
Gleb Mazovetskiy
730c26a856
Migrate maps to unordered maps
2 years ago
Gleb Mazovetskiy
e9c29fa806
Switch to ankerl::unordered_dense
2 years ago
Gleb Mazovetskiy
01147410c1
Add dependency on unordered_dense
...
https://github.com/martinus/unordered_dense
2 years ago
Gleb Mazovetskiy
e7c58ad0ef
Remove missing SfxID
...
Follow-up to #7310
Also removes 1 more unused sound
2 years ago
Gleb Mazovetskiy
80ee326911
Remove unused sounds
...
Done with the following script:
```ruby
tsv = File.read('assets/txtdata/sound/effects.tsv')
all = tsv.lines[1...].map {|l| l.split("\t")[0]}
used = Dir['Source/**/*.{cpp,c,h,hpp}'].flat_map do |path|
File.read(path).scan(/SfxID::[A-Za-z0-9]+/).map {|s| s.split('::')[1]}
end
used.concat(%w[
Warrior69b
Sorceror69b
Rogue69b
Monk69b
Swing2
SpellAcid1
OperateShrine1
Warrior14b
Warrior14c
Warrior15b
Warrior15c
Warrior16b
Warrior16c
Warrior2b
Warrior2c
Rogue14b
Rogue14c
Sorceror14b
Sorceror14c
Monk14b
Monk14c
])
used.sort!
used.uniq!
unused = all - used
unused.sort!
File.open('assets/txtdata/sound/effects.tsv', 'w') do |f|
f.write(tsv.lines[0])
tsv.lines[1...].each do |line|
fields = line.split("\t")
if unused.include?(fields[0])
puts fields[2].tr('\\', '/')
else
f.write(line)
end
end
end
```
2 years ago
Gleb Mazovetskiy
7bfc8e91bd
Update devilutionx.pot
...
Using tools/update_translations_pot.py
2 years ago
Gleb Mazovetskiy
b57fac6419
Add tools/update_translations_pot.py
...
Updates Translations/devilutionx.pot using xgettext
2 years ago
Gleb Mazovetskiy
8633be3578
Fix "Book of" translations
2 years ago