Frank - 2012-07-25

I know that XECUTE command is much less efficient since it needs both run-time compilation of the code and an entry in the invocation stack.

I have the following command

s var="s ^globalname(sub1,sub2,sub3)=value" or s var="s value=^globalname(sub1,sub2,sub3)"
x var

Can someone give me some clue how much performance cost it is for the xecute command above?  If that can save me a global access, should I go for it or the xecute command cost much more time than additional global hit.

Also another question:
Suppose a global is set in the database, I need to get the told value from global and update the global to a new value.  there are two options:
1. Read the global, kill the global and then immediately set it with new value.
2. Read the global and then set the global with new value. 

I know option 2 is more efficient.  But does option 1 takes twice time as option 2 or just slightly more time than option 2 since it operate ones in cached data?

Thanks a lot.