Improving performance of js binding