[sharing] fix performance issues

This is still work in progress.

Should fix #11375