Skip to content

Conversation

@sclaiborne
Copy link
Member

@sclaiborne sclaiborne commented Dec 3, 2021

Important notes:

  1. (w)Strings with lengths longer than VAR_STRLEN_NAME (120) chars will only report on change if its in the first 120 chars
  2. This increases the stack size of call by VAR_STRLEN_NAME (120) + UDINT (4) bytes
  3. This increases cpu usage of the call by about 1 strlen (max 120 chars) and 1 strcmp (max 120 chars)

@sclaiborne sclaiborne changed the title Add 'change' status to varGetValue Add 'changed' status to varGetValue Dec 3, 2021

// Check for value changed
if( valueStringLen != strlen(ipVariable->value)
|| strcmp( valueString, ipVariable->value )) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this instead be memcmp as we know the string lengths are already the same? I am not sure if that optimization gains us much if anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants