optimize ui thread operations