After recently deploying a Yii2 REST app, we’ve also noticed that it is slower than the Yii v1 it was refactored from. The data models are pretty much the same, the database is exactly the same. The difference we are seeing is a lot less than OP (and I realize he was comparing Yii2 REST to non-REST, but I assume there are some similar issues), but still would like to see if we can speed it up a bit - it takes something in the order of 150-300ms more for the Yii2 REST app (450-650ms total) where the original Yii app, which on average takes about 300-400ms. The original app uses mostly non-AR select queries and the Yii2 one does use ActiveQuery/AR etc. – it’s pretty much an out-of-the-box Yii2 REST implementation.
The Yii2 app is on PHP 7 and the original app is 5.6, so it’s not a 1-1 comparison, however I had hoped PHP 7 would make up for the Yii2 REST framework overhead. I can try porting over some of the non-AR endpoints from the original app and get some timings on those to have a closer comparison.
I realize this is not enough to yield specific "fix" advice, but I do wonder if anyone else has had similar experience and could offer general advice about optimizing Yii2 REST apps? Thanks.