Avatar
Please consider registering
guest
sp_LogInOut Log Insp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSSsp_TopicIcon
AddReference and AddNewReference differences
May 22, 2017
12:26, EEST
Avatar
Xavier
Member
Members
Forum Posts: 43
Member Since:
March 26, 2014
sp_UserOfflineSmall Offline

Hello,

I had a performance problem when creating a server with 30 000 references created from always the same object to around 15 000 different objects (1 custom reference and 1 hasEventSource reference). I was gonna ask here but then I found the addNewReference method. What was taking 25 minutes is now taking a few hundreds milliseconds so it’s perfect.

I believe that the performance cost is that when using addReference it has to check all existing references before creating a new one. With addNewReference I think that it is added without testing which is way faster when you have thousands of references.

The addNewReference method is not documented so I just would like to be sure that it’s ok to use this way and that it has no drawback?

Thanks.

May 22, 2017
13:48, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1047
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Yes you are correct, it behaves as you expect. Seems we are missing javadocs there.. in fact the only mention is in the 2.0.0 release notes which stated “New: ServerNode.addNewReference() – fast implementation without checks “.

As long as you are sure the reference does not exist in the node already, there should be no drawbacks.

– Bjarne

(As a note for future readers, the method is in ServerNode, i.e.server side implementations of UaNode and not directly in UaNode interface)

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 35
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 90
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 734
Moderators: 8
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1545
Posts: 6521
Newest Members:
wilfredoforeman, ptdenriqueta, basilpullman, Richardmip, mood edibles, LouieWreve, daniellabdx, janessan21, sammiebeak359, gena7127517
Moderators: Jouni Aro: 1029, Pyry: 1, Petri: 1, Bjarne Boström: 1047, Jimmy Ni: 26, Matti Siponen: 353, Lusetti: 0, Elias: 0
Administrators: admin: 1