mdavidsaver / pvxs

PVA protocol client/server library and utilities.
https://mdavidsaver.github.io/pvxs/
Other
19 stars 25 forks source link

Optimizations #29

Closed mdavidsaver closed 1 year ago

mdavidsaver commented 1 year ago

Some prospective optimizations reducing overheads. In a testable state.

AppVeyorBot commented 1 year ago

:x: Build pvxs 1.0.810 failed (commit https://github.com/mdavidsaver/pvxs/commit/05d3d00b33 by @mdavidsaver)

mdavidsaver commented 1 year ago

Reworked FreeList to avoid MSVC complications. Now a single malloc() for each Struct instance. Including ref-counter, but excepting std::string and shared_array members. Comes at the cost of manual ref. counting, with the risks this entails.

AppVeyorBot commented 1 year ago

:white_check_mark: Build pvxs 1.0.815 completed (commit https://github.com/mdavidsaver/pvxs/commit/db88c87a88 by @mdavidsaver)

mdavidsaver commented 1 year ago

Partially merged as of b0c36f365e7951e2bcce7f026cfeb80c74839683

The remaining unmerged optimization is FreeList for Value. Expanding the benchdata microbenchmark shows a ~50% reduction (2.2us -> 1.2us) in the time needed to allocate an empty NTScalar from a FreeList (Linux/amd64, GCC -O3). Times in nanoseconds.

circa 6b2f0918e3d117ca9a4b95fbed52cdc5a9160b19

$ ./test/O.linux-x86_64/benchdata 
# benchAllocNTScalar
# N=1000 2209.29 +- 1781.44 [956, 16080] first=5403
...

With this PR

$ ./test/O.linux-x86_64/benchdata  
# benchAllocNTScalar
# raw alloc N=1000 2273.32 +- 1941.03 [970, 21297] first=8999
# fl  alloc N=1000 1288.17 +- 162.47 [1181, 5625] first=5625
...
AppVeyorBot commented 1 year ago

:x: Build pvxs 1.0.817 failed (commit https://github.com/mdavidsaver/pvxs/commit/1df3f57b4b by @mdavidsaver)

AppVeyorBot commented 1 year ago

:white_check_mark: Build pvxs 1.0.824 completed (commit https://github.com/mdavidsaver/pvxs/commit/1da4fa6086 by @mdavidsaver)

AppVeyorBot commented 1 year ago

:x: Build pvxs 1.0.827 failed (commit https://github.com/mdavidsaver/pvxs/commit/50e3173f70 by @mdavidsaver)

mdavidsaver commented 1 year ago

This final iteration switches to a different approach to a Value free-list for client subscriptions. Complete Value instead of void*.

mdavidsaver commented 1 year ago

Merged as 8972e93a35f30c136d3ef4b6f7c77d657cce4bba