Attention is currently required from: lynxis lazus.
kirr has posted comments on this change by kirr. ( https://gerrit.osmocom.org/c/osmocom-bb/+/39534?usp=email )
Change subject: trx_toolkit/transceiver: Do not scan tx_queue twice on tx path
......................................................................
Patch Set 1:
(1 comment)
File src/target/trx_toolkit/transceiver.py:
https://gerrit.osmocom.org/c/osmocom-bb/+/39534/comment/acc194fa_2837d7c6?u… :
PS1, Line 315: self._tx_queue_lock.acquire()
Thanks for feedback.
> The strange thing is, with %timedif what you've used with ipython, it is much slower.
When you are measuring with cProfile, what actually happens is that python execution is instrumented and the profiler gets to run every Nth instruction. Measuring overall time with profiler thus measures significantly adjusted code and the profiler usage can affect the result significantly if it is used for microbenchmark link this.
When you are measuring with %timeit of IPython, the code only gets executed for many times without any instrumentation. It thus reflects that actual execution time that we get during regular usage more closely.
Here is indirect proof that profiling is instrumenting the code when running it:
```diff
diff --git a/bench.py.orig b/bench.py
index 4cce94c..92f44ee 100644
--- a/bench.py.orig
+++ b/bench.py
@@ -46,6 +46,7 @@ def testrun(size):
lcomp = cProfile.Profile(timeunit=0.000_000_001)
lcomp.run('do_diff(testvec)')
lcomp_stat = lcomp.getstats()
+ lcomp.print_stats()
forloop = cProfile.Profile(timeunit=0.000_000_001)
forloop.run('do_forloop(testvec)')
forloop_stat = forloop.getstats()
@@ -54,6 +55,6 @@ def testrun(size):
print(f"{size}: forloop {forloop_stat[0].totaltime}")
testrun(1024)
-testrun(100)
-testrun(10)
-testrun(1)
+#testrun(100)
+#testrun(10)
+#testrun(1)
```
```console
(osmo.venv) kirr@deca:~/src/osmocom/t$ python bench.py
7 function calls in 0.000 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 <string>:1(<module>)
1 0.000 0.000 0.000 0.000 bench.py:20(do_diff)
1 0.000 0.000 0.000 0.000 bench.py:21(<listcomp>)
1 0.000 0.000 0.000 0.000 bench.py:22(<listcomp>)
1 0.000 0.000 0.000 0.000 bench.py:23(<listcomp>)
1 0.000 0.000 0.000 0.000 {built-in method builtins.exec}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
1024: lcomp 0.000209867
1024: forloop 0.00011744300000000001
```
the `.getstats()` low-level method, that you used in measurements, is exactly the same method that is used by the profiler to build statistics out of lsprof samples:
https://github.com/python/cpython/blob/v3.11.9-9-g1b0e63c81b5/Lib/cProfile.…https://github.com/python/cpython/blob/v3.11.9-9-g1b0e63c81b5/Lib/cProfile.…
So in my view the benchmarks speak for the "forloop" variant to be better.
--------
Besides that I would not go to microoptimize the code on python level, because in my view here the actual difference in between both versions is not that high and it does not contribute so much compared to other changes, like not doing tx work from under lock, and not doing useless copies. From that point of view the "forloop" variant also looks better because it is more logical to scan the queue only once extracting all the things at once.
By the way it actually turned out that this part of the code does not occupy lot of time, at least not with 4 trx. And if it will start to occupy lots of time it is better to change tx_queue to priority queue instead of still linearly scanning it all the time.
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/39534?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I225c44c4cc327b6786efce96d1278c6ec68fbc25
Gerrit-Change-Number: 39534
Gerrit-PatchSet: 1
Gerrit-Owner: kirr <kirr(a)nexedi.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-CC: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Comment-Date: Sat, 15 Feb 2025 20:18:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: lynxis lazus <lynxis(a)fe80.eu>
Attention is currently required from: fixeria.
laforge has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/erlang/logger_gsmtap/+/39553?usp=email )
Change subject: Create GSMTAP sink to avoid ICMP errors
......................................................................
Patch Set 1: Code-Review+1
(1 comment)
Patchset:
PS1:
might be worth making the sink creation optional. But then, failure is ignored anyway, so not critical.
--
To view, visit https://gerrit.osmocom.org/c/erlang/logger_gsmtap/+/39553?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: erlang/logger_gsmtap
Gerrit-Branch: master
Gerrit-Change-Id: I1b103bb16d2e9f0bc6296a2feda138364ed640e2
Gerrit-Change-Number: 39553
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Sat, 15 Feb 2025 19:47:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: fixeria.
laforge has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/39556?usp=email )
Change subject: s1ap_proxy: catch exceptions in handle_pdu/2
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/39556?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: Ib1e6674f5b85557866c7beaea710ea903e4eeaca
Gerrit-Change-Number: 39556
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Sat, 15 Feb 2025 19:44:23 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: fixeria.
laforge has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/39555?usp=email )
Change subject: erab_fsm: pretty-print U2CM and U2AM during MODIFY Req/Ind
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/39555?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I2a8bac479bdf8076fdb8b379361aff7b549babcd
Gerrit-Change-Number: 39555
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Sat, 15 Feb 2025 19:43:33 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: pespin.
laforge has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmocore/+/39554?usp=email )
Change subject: tests: soft_uart: Fix printf int type format
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39554?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib8f190c81f20a28081b06cbd3de099f2b87372f4
Gerrit-Change-Number: 39554
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Sat, 15 Feb 2025 19:43:16 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes