CoDev interview question

How to optimize SQLs and Javascript codes?