NER: fast way of entity label extraction

I have created a custom NER model with 7 labels. When I run a query of 4000 examples through my trained prodigy model, I use nlp.pipe. Here's the flow.
First, I created a list of text strings to feed into the model:
texts = list(my_pdframe)
Then, I run texts through my model:
mydocs = list(nlp.pipe(texts))
This part is pretty fast, ~4 sec. I understand that mydocs is a list of Spacy Doc objects. At this point, my goal is to get out the labels and texts out of mydocs[i].ents as speedy as possible. If I simply loop through all mydocs (4000 obejcts) and get .label and .text from each mydocs[i], it takes ~75 sec. Could you suggest faster ways of doing this?
Thank you in advance.

If you're doing list(nlp.pipe(texts)) and then looping over the result, you're looping twice: once to consume the generator, once to extract the text and labels. So you probably want to loop over nlp.pipe(texts) (an iterator of Doc objects) once and do the extraction at the same time.

Not sure why getting the text and label from the doc.ents would be taking long – maybe there's something you can improve about the way you loop? The slowest part should definitely be the prediction. If you don't need the string values right away, you could get the hash IDs instead and use Span.orth and Span.label, and then loop them up in the string store when you need them.

Also, just for completeness, the absolute fastest way to do most things is obviously directly from Cython: https://spacy.io/api/cython

Thank you, Ines. This is helpful. I wanted to clarify a couple of points. You mentioned that in my original implementation I was looping twice. You suggest to to loop over nlp.pipe(texts) (an iterator of Doc objects). When I create this iterator, is that counted as one loop?