weiweitop / weiweitop.github.io

自得其乐 知足常乐
MIT License
1 stars 0 forks source link

尝试测量Java对象的销毁时间 | 闲云野鹤 #31

Open weiweitop opened 3 years ago

weiweitop commented 3 years ago

https://weiweitop.fun/2021/05/21/尝试测量Java对象的销毁时间/

Oh, and one more thing: there is a severe performance penalty for using finalizers. On my machine, the time to create and destroy a simple object is about 5.6 ns. Adding a finalizer increases the time to 2,400 ns. In other words, it is about 430 times slower to create and destroy objects with finalizers. ——Effective Java Second Edition