sc icon indicating copy to clipboard operation
sc copied to clipboard

sc_sock: use dense events array instead of a sparse one on Windows

Open svladykin opened this issue 2 years ago • 2 comments

Optimization:

  • O(1) sc_sock_poll_add
  • work with only count events instead of cap
  • events array is not sparse anymore
  • sc_sock_poll_wait returns 0 if no events were actually triggered

svladykin avatar Aug 10 '22 06:08 svladykin

Codecov Report

Merging #91 (9e4f201) into master (0b74cbc) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #91   +/-   ##
=======================================
  Coverage   99.81%   99.81%           
=======================================
  Files          21       21           
  Lines        2192     2192           
  Branches      385      385           
=======================================
  Hits         2188     2188           
  Partials        4        4           
Impacted Files Coverage Δ
socket/sc_sock.c 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0b74cbc...9e4f201. Read the comment docs.

codecov[bot] avatar Aug 10 '22 06:08 codecov[bot]

There is a bug in this PR though: we do not update fdt->index on the moved last element. Tests do not catch it, probably need to store the pointer to the actual fdt alongside with data.

svladykin avatar Aug 10 '22 07:08 svladykin

Ok, this approach does not work at all in case when we delete a socket from poll inside of the event loop.

svladykin avatar Aug 11 '22 03:08 svladykin