Timeline for Stack data structure implementation
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 27, 2017 at 13:08 | comment | added | Alejandro |
In the original code the popped node will be garbage collected, as nothing else than the top field refers to it, and that reference will go away as soon as the new top is assigned, making the old top eligible for GC in that line.
|
|
Mar 26, 2017 at 0:54 | comment | added | VisualMelon | I don't think this is a reasonable suggestion: it adds 2 lines of code that have no logical purpose (just add noise to the code), and I'm less than convinced they provide any benefit whatsoever (certainly shouldn't if the node is still in Gen0). If nothing is pointing at the node (which it isn't), then it doesn't matter what it is pointing at, those things can still be collected, so this is just a performance concern. | |
Mar 25, 2017 at 20:41 | comment | added | t3chb0t | @JoanDimko do you have or did you do any performance tests? | |
Mar 25, 2017 at 20:40 | comment | added | t3chb0t | @JoanDimko mhmmm... it'd be nice to know how much the performance drops by those two lines... 3ns per 10_000_000 calls? Did you forget to add the performance tag? ;-) | |
Mar 25, 2017 at 20:37 | comment | added | Joan Dimko | It will reduce performance. In memory/speed trade-off requirement prefers speed. | |
Mar 25, 2017 at 20:06 | history | answered | t3chb0t | CC BY-SA 3.0 |