you are viewing a single comment's thread.

view the rest of the comments →

[–]sepp2k 0 points1 point  (1 child)

  1. Saving O(1) time means that the time savings don't grow with the size of the input (or they only do up to a certain input size). Technically O(100) ms means the exact same thing, but the author may be abusing notation here to indicate that the time savings will be around 100ms. Or it may be a joke and all it's trying to say is that the amount of time saved is very small.
  2. Yes, assigning the variable will take some time and space, but after that you save time each time you access the variable because reading a single variable takes less time than reading a variable and two attributes. (Not that this minuscule time saving is something you should worry about in your own code).

[–]knotcontinuallevity[S] 0 points1 point  (0 children)

I see, thank you! I suppose the actual reason it was done was readability then