官术网_书友最值得收藏!

Inlining parameters of closure type

Usage of higher-order functions can lead to a decrease of runtime performance. Memory allocations of the functions passed as lambda arguments and their virtual calls in a function body lead to runtime overhead. However, in many cases, we can eliminate this type of overhead by inlining the lambda expression parameters.

In this recipe, we are going to implement the lock() function that will automate work with the Java java.util.concurrent.locks.Lock interface. The function will take two arguments—an instance of the Lock interface and the function that should be invoked after the lock is acquired. Finally, our lock() function should release the lock. We also want to allow making the function parameter inlined.

主站蜘蛛池模板: 崇明县| 香格里拉县| 博兴县| 波密县| 宿迁市| 郸城县| 徐闻县| 兴山县| 白山市| 阳东县| 会东县| 灵石县| 定远县| 红安县| 河南省| 兴化市| 东阳市| 铜山县| 剑川县| 镇雄县| 九龙城区| 疏勒县| 清水河县| 绥中县| 阿鲁科尔沁旗| 绥棱县| 大厂| 荆门市| 新巴尔虎右旗| 镶黄旗| 冕宁县| 太谷县| 忻城县| 新巴尔虎左旗| 留坝县| 济南市| 固原市| 灌云县| 仙游县| 仁怀市| 乌什县|