Editing historian tag data

Throw this into your script console and run it.

from java.lang import System

tagPaths = []
ret = 0
currentTime = system.date.now()

for i in range(400):
	tagPaths.append('[Client]CurrentTime')
	

start = System.nanoTime()

for i in range(400):
	ret = system.tag.readBlocking(tagPaths[i])
	
end = System.nanoTime()

print '400 singular reads took %.3f ms' % ((end-start) / 1000000.0)

values = []
paths = []

start = System.nanoTime()

for i in range(400):
	values.append(currentTime)
	paths.append('[Client]CurrentTime')
	if i % 5 == 0:
		ret = system.tag.readBlocking(paths)
		values = []
		paths = []

end = System.nanoTime()

print '400 readss in blocks of 5 took %.3f ms' % ((end-start) / 1000000.0)

values=[]
paths = []

start = System.nanoTime()

for i in range(400):
	values.append(currentTime)
	paths.append('[Client]CurrentTime')
ret = system.tag.readBlocking(paths)

end = System.nanoTime()

print '400 reads in 1 block took %.3f ms' % ((end-start) / 1000000.0)

Here were the results on my system:

>>> 
400 singular reads took 16.169 ms
400 reads in blocks of 5 took 3.345 ms
400 reads in 1 block took 0.569 ms
>>> 

As the size of the system and load on the gateway changes these results will very, however, reading all tags at once will remain the fastest by a lot.

3 Likes