We have recently switched from the perforce-plugin to p4-plugin but are seeing a performance issue on our perforce server. The p4-plugin seems to be querying more changes from the perforce server than necessary.
For example I see it doing:
p4 changes -m100 //myclientname/...@0,2126849
which returns 100 changelists and p4-plugin then proceeds to do "p4 change -o <change> , p4 user -o <user> and p4 describe -s <change> for every one of those 100 changes.
But the previous build in jenkins for that job was changelist 2125434 so if p4-plugin had done the following query:
p4 changes -m100 //myclientname/...@2125434,2126849
it would have only returned one change (as many changes were outside the view of this client workspace) and then the load on the main perforce server would be much reduced.
Why isn't p4-plugin using the changelist number of the previous build to reduce the amount of queries?
Originally I did exactly that (used the previous build to get the changelist number), however that lead to numerous issues (if the previous build didn't occur was aborted etc...)
The plugin uses 'p4 cstat' to calculate the starting change. If your use the 'Auto clean and sync' option then the range for 'p4 changes' will be smaller. For the initial 'first' build or if you use 'Forced clean and sync' option, the range will start from 0. I had hoped that limiting it to 100 changes would minimise the impact, perhaps your change lists are large and it's the describe that is expensive.
I agree that the whole change-list reporting could be more optimal, if you have any ideas or want to help contribute let me know.