optimize: use binary search to store values in set-arrays