I know the best four naive ways of achieving this.
Commit count: In the code repository count the number of commits done by a user. However this is just what the name says, counting the commits. It cannot separate near empty commits from commits having hours of thinking and sweat.
Line count: Counting the number of lines of code produced by a developer. However developers can practice verbose programming, use inefficient algorithms which take lots of code to be made, or just create ugly and large code. So it is hard to use this as a good metric of the work performed.
Time count: I could count the time that a developer spent working. But no one can work one hour straight. Moreover, some programmers can preform 2h of work in just 1h, and vice-versa. And in the end is not the time that counts but the progress the project made. I don't care if a developer spends 5 years or 5 minutes coding, in the end the project is to be completed in its due date. This leads to our final bullet:
Feature count: Counting the number of features closed by a developer will keep track of the overall project's progress. However I cannot tell if those features were toy-features or they were insanely hard to accomplish. Moreover, I cannot tell one developer from another in order to see who performed most of the work. I could estimate the difficulty of each feature, however most of the times that is unfeasible because (i) it is frequent that unexpected problems arise during a feature, (ii) we tend to over simplify things, (iii) for some significant amount of features the work of estimating their difficulty greatly overlaps with the task of doing it, i.e., we can only know how long it takes to close that feature after closing it.
So, in the end, how can one measure, quantify and compare the work performed by developers in a project?