Will doing this be impactful to performance?

Hi developers,

I have a function that returns data from a dictionary. It basically checks if they key exists then returns its value. Will calling this, say, every time the value of a users money be impactful to performance?

I don’t understand why you would micro-optimize this, unless you’re intensively calling this method a lot of times. To answer this in short: No, it won’t be impactful to performance.

However, the long answer depends a lot on architecture and tactical approaches of doing things. Usually returning data from a dictionary is in the complexity of O(1), which essentially means a single call does not scale its time to finish proportionally to size of dictionary and it is always constant. In total, there would be two operations needed.

Unless there are some asynchronous actions, it will complicate things a little, like race conditions as a problem. Normally this doesn’t occur until you put up two or more scripts managing one calue.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.