How to optimize this function ?

Printable View