Hello Jenkins Builder, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmocom-bb/+/39536?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed: Code-Review+1 by pespin
Change subject: trx_toolkit/*: Represent bursts as arrays instead of lists ......................................................................
trx_toolkit/*: Represent bursts as arrays instead of lists
Continuing fake_trx profiling story I noticed that on rx path a noticeable time is spent in converting from ubits to sbits via list comprehensions. By changing burst representation from py list, which stores each item as full python object, to an array, which stores each item as just byte, and by leveraging bytearray.translate, we can speed up that conversion by ~ 10x:
before:
In [1]: from data_msg import Msg
In [2]: burst = [0, 1] * (142//2)
In [3]: burst Out[3]: [0, 1, 0, 1, 0, ... 0, 1]
In [4]: Msg.ubit2sbit(burst) Out[4]: [127, -127, 127, -127, ... 127, -127]
In [5]: %timeit Msg.ubit2sbit(burst) 3.01 µs ± 43.3 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)
after:
In [2]: burst = bytearray([0, 1] * (142//2))
In [3]: burst Out[3]: bytearray(b'\x00\x01\x00\x01...\x00\x01')
In [4]: Msg.ubit2sbit(burst) Out[4]: array('b', [127, -127, 127, -127, ... 127, -127])
In [5]: %timeit Msg.ubit2sbit(burst) 325 ns ± 12.1 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)
Change-Id: I7314e9e79752e06fa86b9e346a9beacc5e59579e --- M src/target/trx_toolkit/data_msg.py M src/target/trx_toolkit/gsm_shared.py M src/target/trx_toolkit/rand_burst_gen.py M src/target/trx_toolkit/test_data_msg.py 4 files changed, 36 insertions(+), 25 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/36/39536/2