piątek, 9 grudnia 2011

How to get data from Visum COM object fast - test of various ways.

There's at least some ways that data from Visum can be donwloaded to COM object.
To see which one is the fastest I carried out this test.

On basic network of 81 nodes I tested times to download the node data.
As results for single operation were unstable I carried the simulations in a loop and tested mean values (1000 iterations).
I've tested following ways to download data:
1.  Visum.Net.Nodes.ItemByKey(1).AttValue("No")
2.   for i in range(1,81): Visum.Net.Nodes.ItemByKey(1).AttValue("No") 
3.   Visum.Net.Nodes.GetMultiAttValues('No')
4.   Visum.Net.Nodes.GetMultipleAttributes(["No","Code","Name","AddVal1","AddVal2","AddVal3"])
5.  List=Visum.Lists.CreateNodeList;

  So the results I got from Python were:
  ItemByKey Node 'No' Single:         0.0022 [s]  
  ItemByKey Node 'No' 81 nodes :      0.1236 [s]
  ItemByKey Node GetMultiAttValues:   0.0020 [s]
  GetMultipleAttributes :             0.0042 [s]
  Create list:                        0.0082 [s]


  Comment:
1. Best way to get single element value: just use ItemByKey(key).AttValue()
2. However putting this procedure into a loop is not a reasonable way to get data of each elements,
3. as bulk download for whole container (GetMulti)  is way faster (actually comparable time to get parameter value for single node than for 81 nodes).
4. Getting 7 attributes of 81 nodes is takes twice the time of single attribute.
5. Creating and downloading a list is twice longer than GetMulti (personally I use list to get data about paths, due to fact that GetMulti is not supported for paths).

Brak komentarzy:

Prześlij komentarz