How to get the number of Performance cores, also known as P-cores in a script?
Optionally, how to get the number of Efficient-cores or Low Power Efficient-cores? (This question does not concern me right now, but it seems fitting and could be of use to future readers. Otherwise, disregard this part.)
Note: if you want to know the number of Physical cores, which would also include Efficient-cores and Low Power Efficient-cores, you can refer to this SO. If you want to list the cores for manual reading and understanding, you can refer to this SO.
This question is specifically on how to find the number of P-cores, from a script.