Are you saying this just hangs (i.e. never completes) when you add 40 or more elements? What versions of the AFSDK and AF server do you have?
If it does complete eventually, can you time the the loop and the check-in separately?
I've found that when using the automatic name generation with AFAnalysis objects that it can be O(n) to create an analysis (where n is the number of existing analyses), but I don't know if this applies to Elements.
When I looked at the AF db, I can see the elements are there.
This is our test box. As i don't have source code there. Only dll.
AF Client installed : PI AF Client 2010 R3 : 18.104.22.16831
The proccess is running on a server that connecting to another AF Server.
Hope this makes sense
Automatic name generation can be expensive, as it requires a roundtrip to the AFServer/Database to compute a uniquename. It is likely more expensive for AFElements/AFModels than for other objects.