Timeline for Should we avoid object creation in Java?
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 19, 2016 at 20:35 | comment | added | J. M. Becker | Thank you for actually standing firm on reality, anyone who lives with the effects of a thoughtless architecture can very much relate. | |
| S May 24, 2012 at 13:44 | history | suggested | Vatine | CC BY-SA 3.0 | changed millibits to megabytes |
| May 24, 2012 at 13:16 | review | Suggested edits | |||
| S May 24, 2012 at 13:44 | |||||
| May 23, 2012 at 23:17 | comment | added | jasonk | Objects are short-lived (less than 0.5sec in the general case). That volume of garbage still affects performance. | |
| May 22, 2012 at 23:52 | comment | added | Andres F. | Wow! 20+ MB to process 50 rows of data? Sounds crazy. In any case, are those objects long-lived? Because that's the case that would matter for GC. If on the other hand you're merely discussing memory requirements, that's unrelated to garbage collection or object creation efficiency... | |
| May 22, 2012 at 14:10 | comment | added | Leo | +1: Unnecessary object creation (or rather cleaning up after removal) can definitely sometimes be costly. 3D Graphics/OpenGL code in java is one place where I have seen optimizations done to minimize the number of objects created since GC can otherwise wreak havoc with your framerate. | |
| May 22, 2012 at 9:41 | comment | added | JimmyB | I may add an example: In some cases it really makes no difference in terms of clarity of code but can make a more or less big difference in performance: When reading from streams, for instance, it is not uncommon to use something like while(something) { byte[] buffer = new byte[10240]; ... readIntoBuffer(buffer); ... which may be wasteful compared to e.g. byte[] buffer = new byte[10240]; while(something) { ... readIntoBuffer(buffer); .... | |
| May 22, 2012 at 2:41 | history | answered | jasonk | CC BY-SA 3.0 |