What is the relation between tournament performance and rating change?

For example: In this arena CM PchelkinVK had a tournament performance 160 points below his rating and gained 1 rating point.
In one tournament I played a performance 40 points above my rating, but lost a few rating points.
Or you play a tournament, win 3 stronger opponents in a row. Then you win against a much weaker opponent, your rating remains (almost) unchanged as expected, but your performance drops significantly.

So I am wondering, how tournament performance and rating change are related to each other on lichess?

In OTB play it is intuitive and straightforward, performance above rating gains points and below loses points ...
Also, if I remember correctly, when you win a game your ELO performance goes up no matter what rating your opponent has.
The main difference is that unlike rating updates which reflect individual game results, rating performance is calculated only from average opponent rating and your overall percentage. In other words, if the average rating of your opponents is e.g. 1800 and you have 50% of points, your rating performance will always be exactly 1800 while the rating update will depend on both results of individual games and also ratings of opponents you scored those results against. As the dependence of the updates on rating differences are not linear, these fluctuations are not always going to cancel out - and they are less likely to do if the average opponent rating differs from your rating.

With Glicko-2, there is also another difference, perhaps even more important: the rating performance formula does not thake rating deviations into account. Therefore if you e.g. lose against an opponents with rating +200 and stable and win against opponents with rating -200 but less stable, the rating performance is going to be equal to your rating but your rating is going to drop.