Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@whitehawk
Copy link

@whitehawk whitehawk commented Mar 10, 2025

DO NOT COMMIT.

Provide MVP implementation of lock free list

Thit patch provides MVP implementation of lock free list and code to compare its performance with list in shared memory with lock protection.

Test implementation for lists with locks is taken from branch 7x_orphaned_files_improvements.

Test procedure to compare performance with lock based list:

# Prepare a table to store testing results
psql postgres -c "create table test_results as select * from lfl_test_perf('lfl', 1, 1)";
psql postgres -c "truncate table test_results";

# Do testing
for ELEM_NUM in 10 100 500 1000 5000; do
	for BATCH_SIZE in 1 10 50; do
		if [ $ELEM_NUM -ge $BATCH_SIZE ]; then
			echo "Test lock free lists: elem num ${ELEM_NUM}, batch size ${BATCH_SIZE}"
			parallel --bar -j `nproc` --gnu "DUMMY={}; psql postgres -c \"insert into test_results select * from lfl_test_perf('lfl', ${ELEM_NUM}, ${BATCH_SIZE});\" > /dev/null" ::: {1..50}
			echo "Test lists with locks: elem num ${ELEM_NUM}, batch size ${BATCH_SIZE}"
			parallel --bar -j `nproc` --gnu "DUMMY={}; psql postgres -c \"insert into test_results select * from lfl_test_perf('non-lfl', ${ELEM_NUM}, ${BATCH_SIZE});\"> /dev/null" ::: {1..50}
		fi
	done
done

and extract test results by:

copy (
select *
from test_results
) to '/tmp/results-all.csv' with csv header;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants