Set many user strings directly

Hello! I was wondering if there is a way in RhinoCommon of replacing the user string NameValueCollection with a new collection in one step. Running SetUserString(key, value) seems to be rather slow.
I am trying to store a key-value pair for each meshface of rather large meshes (>60.000 faces). This takes up to 3 minutes on a moderately fast machine.

List<KeyValuePair<string, string>> values; ///60.000 entries
Mesh m = new Mesh() //60.000 faces
ObjectAttributes oa = new ObjectAttributes()
foreach(KeyValuePair<string, string> entry in values)
oa.SetUserString(entry.Key, entry.Value);
doc.Objects.AddMesh(m, oa);

Is there a way around this using the in-built user strings? Or will I have to create custom user data?



Why do you need to store that many key/value pairs?

No, there is no way to bulk add thousands of key/values. This is better handled by user data…

ok, thanks, I guess I’ll have to create some custom userdata then!

The reason for the many entries is that I need to store face-specific data for a mesh.
Basically, I am importing data which was computed for each face in another software.
At the moment, I am creating 60.000 individual single-face mesh objects with user strings. However, viewport redraw speed gets very slow. Rather than creating thousands of individual meshes therefore, I thought I’d join all the individual faces together and create a list of user string entries, one for each face.
This greatly increses redraw speed but as I said previously, the assignment of such many user strings takes very long.

Thanks again,