Is there a performance difference between primitives and entities?

I have to draw a lot of polylines and billboards to a globe which are also changing based on zoom.
It seems that the rendering is quite slow and I am looking for ways to optimize.
Right now the lines are added to viewer.entities
Is there any difference in performance when using primitives?

The short answer is “it depends”. In most cases there shouldn’t be (or using entities can actually be more optimized) because internally entities are created using the Primitive API, and they’ll often get batched together automatically to make sure it’s fast (which may be hard to do if you’re creating the primitives directly).

How many lines and billboards do you have? Are they clamped to ground (that is generally more costly than non-clamped to ground entities) ? Can you share a Sandcastle reproducing this? See: How to share custom Sandcastle examples

A sandcastle example would be too complex.
I was looking for a general guide.
BabylonJS for example has good clear do’s and dont’s tutorial.
Anyway, I will just have to do more tests.