v.23.2Performance Improvement

Rewrote code for marks distribution to enhance performance, resolving issues #34527 and #43772.

Rewrote the code around marks distribution and the overall coordination of the reading in order to achieve the maximum performance improvement. This closes #34527. #43772 (Nikita Mikhaylov).