`
leonzhx
  • 浏览: 793292 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Item 55: Optimize judiciously

阅读更多

1.  Don’t sacrifice sound architectural principles for performance. Strive to write good programs rather than fast ones.

 

2.  Implementation problems can be fixed by later optimization, but pervasive architectural flaws that limit performance can be impossible to fix without rewriting the system. Therefore you must think about performance during the design process.

 

3.  The components of a design that are most difficult to change after the fact are

those specifying interactions between modules and with the outside world. Chief among these design components are APIs, wire-level protocols, and persistent data formats. Not only are these design components difficult or impossible to change after the fact, but all of them can place significant limitations on the performance that a system can ever achieve.

 

4.  It is generally the case that good API design is consistent with good performance. It is a very bad idea to warp an API to achieve good performance. The performance issue that caused you to warp the API may go away in a future release of the platform or other underlying software, but the warped API and the support headaches that come with it will be with you for life.

 

5.  Once you’ve carefully designed your program and produced a clear, concise, and well-structured implementation, then it may be time to consider optimization, assuming you’re not already satisfied with the performance of the program. Measure performance before and after each attempted optimization.

 

6.  The first step of optimization is to examine your choice of algorithms: no amount of lowlevel optimization can make up for a poor choice of algorithm.

 

7.  The need to measure the effects of attempted optimization is even greater on the Java platform than on more traditional platforms, because the Java programming language does not have a strong performance model. The relative costs of the various primitive operations are not well defined.

 

8.  If you will be running your program on multiple JVM implementations or multiple hardware platforms, it is important that you measure the effects of your optimization on each. Occasionally you may be forced to make trade-offs between performance on different JVM implementations or hardware platforms.

 

分享到:
评论

相关推荐

    Effective Java 3rd edition(Effective Java第三版英文原版)附第二版

    Item 55: Return optionals judiciously Item 56: Write doc comments for all exposed API elements 9 General Programming Item 57: Minimize the scope of local variables Item 58: Prefer for-each loops to ...

    OPTIMIZE PI使用指南

    OPTIMIZE PI使用指南 OPTIMIZE PI是一款电源仿真软件,由Cadence Design Systems开发,用于优化电源系统的设计和仿真。下面是OPTIMIZE PI使用指南的详细知识点: 一、OPTIMIZE PI概述 OPTIMIZE PI是一款基于...

    Qualcomm Hexagon SDK: Optimize Your Multimedia

    ### Qualcomm Hexagon SDK: 深入解析与多媒体优化 #### 一、Hexagon SDK简介 **Qualcomm Hexagon SDK** 是由Qualcomm Technologies, Inc.开发的一款强大的软件开发工具包,旨在帮助开发者轻松利用Hexagon数字信号...

    High Performance iOS Apps: Optimize Your Code for Better Apps [2016]

    EPUB + PDF Ready to build mobile apps that out-perform the rest?... You’ll learn how to design and optimize iOS apps that deliver a smooth experience even when the network is poor and memory is low.

    WordPress主题:Optimize 4.1WP主题by Insertcart2022年最新版.zip

    "WordPress主题:Optimize 4.1WP主题by Insertcart2022年最新版 WordPress主题/WordPress插件/html网站模板/iOS app源码/安卓app源码 每天更新上传!" ---------- 每天更新发布最新WordPress主题、HTML主题、...

    .NET开发性能优化 (英文版)

    《Pro .NET Performance: Optimize Your C# Applications》是一本专为.NET开发者设计的性能优化指南,由专家级作者编写,旨在帮助读者深入理解.NET框架的内部工作原理,并提供实用的技巧和策略来提升C#应用程序的...

    Optimize-Offline:Optimize-Offline是Windows 10离线图像优化框架

    优化离线Optimize-Offline是Windows映像(WIM / ESD)优化模块,设计用于Windows 10版本1803-2004年的64位体系结构。关于优化离线通过消除不必要的膨胀,增强隐私性,改善美观性并提高系统性能来扩展用户体验。 接受...

    ojc:optimize javascript and css代码工具包

    optimize javascript and css代码工具包 基于NodeJs环境的JS、CSS打包部署工具 1.jsp、html文件中编写格式 js例子: [removed][removed] [removed][removed] [removed][removed] 上面例子的意思是把app下面的utils....

    scikit-optimize依赖包

    Scikit-optimize,也称为skopt,是Python中一个用于高效优化算法的库,特别适合在高维度空间中进行参数调优。它基于Bayesian优化、随机森林和Gaussian过程等机器学习技术,为用户提供了一套简洁而强大的接口来解决...

    optimize-ready:Google Optimize的事件监听器

    优化就绪Google Optimize的事件监听器修改版使开发人员可以等到Optimize加载后再运行某些代码。 当Optimize加载缓慢(例如,如果通过GTM加载)且站点js依赖于实验中所做的更改时(在我们的用例中,我们需要等到进行...

    人工智能-项目实践-强化学习-基于pytorch的强化学习2d机械臂小实验(DDPG算法).zip

    基于pytorch的2d机械臂强化学习项目。最近学习莫烦大神的强化学习课程: RL-...Part 5: Optimize and debug it Final: Make a moving goal 该部分代码对应final部分,只更改了rl.py部分,替换tensorflow为pytorch。

    System Optimize Tools V1.0.1

    System Optimize Tools V1.0.1 System Optimize Tools V1.0.1 System Optimize Tools V1.0.1 System Optimize Tools V1.0.1 System Optimize Tools V1.0.1 System Optimize Tools V1.0.1 System Optimize Tools V...

    WP-Optimize插件

    WP-Optimize插件就是帮你解决这个问题的,它可以优化和删除那些存在于数据库中的冗余数据,它具有以下特点: •删除修改后的WordPress中的冗余数据 •删除所有评论中的垃圾数据 •删除无效的留言 •为你的用户...

    react-optimize:使用Google Optimize进行ReactJS AB测试

    React优化 与Google Optimize集成。 文件: 使用GTAG优化部署: : 优化JS API: : 安装yarn add react-optimize首先,您需要添加带有优化容器ID的gtag代码段。 如果您使用的是 ,则可以将以下内容添加到public/...

    Laravel开发-laravel-optimize-images

    `laravel-optimize-images`是一个针对Laravel 4的扩展,旨在帮助开发者更有效地管理和优化项目中的图片资源。这个扩展提供了命令行工具,使得批量处理和优化图像变得更加便捷。 在深入探讨`laravel-optimize-images...

    基于pytorch的2d机械臂强化学习项目

    Part 5: Optimize and debug it Final: Make a moving goal 该部分代码对应final部分,只更改了rl.py部分,替换tensorflow为pytorch。 只有part 4,part5,final涉及强化学习,只需要替换rl.py文件即

    SSD Optimize v1.1 Build 823

    SSD Optimize v1.1 Build 823是一款专为固态硬盘(SSD)设计的优化软件,旨在最大化地提升SSD的性能和寿命。固态硬盘与传统的机械硬盘(HDD)在工作原理上有所不同,SSD没有机械部件,数据读取速度更快,但写入操作...

Global site tag (gtag.js) - Google Analytics