I have a script that iterates through 20 system.tag.writeAll functions, sort of like what follows. It’s only writing five values at a time, but the script takes about XX seconds to complete, which seems really excessive. Am I doing something wrong? Is there a faster way to accomplish this?
x = 0
while x <=19:
val1 = somevalue
val2 = somevalue
val3 = somevalue
val4 = somevalue
val5 = somevalue
I did as you suggested, and have much better results. Thanks very much for your help. I didn’t know about the list.extend() function, and that was very helpful in accomplishing this.
You should not need to call extend() explicitly. Try the following.
vals = []
tags = []
for x in range(20):
val1 = somevalue
val2 = somevalue
val3 = somevalue
val4 = somevalue
val5 = somevalue
vals += [val1,val2,val3,val4,val5]
tags += ["prefix_%d_suffix%d"%(x,i) for i in range(5)] #This creates an in place list for us, and appends it to the main list
system.tag.writeAll(tags,vals)