Skip to content

Commit 5715684

Browse files
committed
Optimizing: Added page with runtime speed tips
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
1 parent a117142 commit 5715684

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

Optimizing_runtime_speed.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Optimizing runtime speed
2+
3+
Here you have a few tips which may help you speed up your BabbleSim simulations:
4+
5+
* In the Phy disable traces if you don’t need them with the -nodump command line option.
6+
* When building your embedded SW, note that in general, options that have a runtime performance impact in embedded targets will also have it in simulation.
7+
* If you are using Zephyr:
8+
* By default CONFIG_COVERAGE is enabled by compile.sh, if you are not using it, disable it.
9+
* By default CONFIG_NO_OPTIMIZATIONS is enabled to ease debugging. But for speed you may want to set CONFIG_SPEED_OPTIMIZATIONS=y instead.
10+
* Do not enable CONFIG_ASAN or UBSAN unless you want to debug (they have a performance penalty)
11+
* Disable logging if possible, if not, at least minimize it. If not possible, reduce the verbosity when calling zephyr.exe with -v=0.
12+
* In general, options that have a runtime performance impact in embedded targets will also have it in simulation.
13+
* In your Zephyr test/app: Wherever possible use Zephyr kernel synchronization primitives instead of busy waiting with k_busy_wait(). If you need to busy wait for long times increasing the duration to each k_busy_wait() call.
14+
* You will have significantly better performance running in a bare-metal Linux installation than in a virtual machine (WSL2 is a virtual machine). If you cannot, at least, ensure the Intel/AMD virtualization instructions are enabled (both in your Virtual machine and in the computer UEFI/BIOS)
15+
* In your test, end the test as soon as you are done, instead of waiting for a timeout from the Phy. If one device is done in a simulation while others need to continue without it, have that device disconnect from the simulation while others are let to continue.
16+
* Run with reduced verbosity for all simulated devices and the Phy (by default it is `-v=2`, but you can lower it to `-v=0`)
17+
18+
Beware of other programs running in the computer. The impact can be much bigger than you think. Typical offenders are Chrome/Electron based apps.

index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ This is BabbleSim's list of [design choices & objectives](objectives.md)
152152
* [Importing BLE activity into the Ellisys BT analyzer SW](import_Ellisys.md)
153153
* [Selecting channel and modem for the 2G4 Phy](2G4_select_ch_mo.md)
154154
* [Design choices and objectives](objectives.md)
155+
* [Optimizing runtime speed](Optimizing_runtime_speed.md)
155156
* [Frequently asked questions](faq.md)
156157
* [Infrequently asked questions](ifaq.md)
157158
* [Releases](Releases.md)

0 commit comments

Comments
 (0)