UCP extension, performance optimisation in JS