program/code optimization
来源:互联网 发布:bilibili mac版下载 编辑:程序博客网 时间:2024/06/17 01:50
In computer science, program optimization or software optimization is the process of modifying a software system to make some aspect of it work moreefficiently or use fewer resources.In general, a computer program may be optimized so that it executes more rapidly, or is capable of operating with lessmemory storage or other resources, or draw less power. (wiki)
Levels of optimization
Design - architecture(network latency bounded, program language, platform, goal)
Algorithm and data structure - algorithm(constant,logarithmic,linear,log-linear; quadratic complexity O(n^2) fail to scale); data structure(use abstract data types in function definitions, restrict the concrete definition to a few places); memoization (cache the result of expensize function call)
source code level - for, while
build level - optimizing compile; preprocessor directive(for specific hardware)
assembly language - operating system on embedded systems writen in assembly language
Algorithm and data structure
algorithm(constant,logarithmic,linear,log-linear; quadratic complexity O(n^2) fail to scale);
data structure(use abstract data types in function definitions, restrict the concrete definition to a few places)
memoization (cache the result of expensize function call)
optimize the code
limitation of the compiler
1. alias of the storage address - two pointer points to the same address
2. side effect of subfunction - subfunction change the value of global variable
loop-invariant code motion - low efficiency of the for loop
as to some code in the for loop, the execution result remains the same with every iteration. it would be more efficient to move this code block out of the for loop
reduce unnecessary reference/read/access to the memory/storage/disk
if it is not the final value, it is better to store it to a temporary varaible. And, just write the final result once to the memory. This reduce the memory access.
0 0
- program/code optimization
- code program
- whole program optimization 优化选项
- Code optimization summary
- Memory Hierarchy / Program Optimization(程序优化)
- Code Optimization: Effective Memory Usage
- js.program code
- Hadoop example program code
- MapReduce program example code
- Visual C++ Optimization with Assembly Code
- Visual C++ Optimization with Assembly Code
- Code Optimization Using the GNU C Compiler
- Writing-Efficient-C-and-C-Code-Optimization
- first step in order to optimization of my C program
- optimization
- optimization
- Optimization
- optimization
- ostu阈值分割
- Spring源码解析——如何阅读源码
- 北航复试上机14真题
- Spark Checkpoint写操作代码分析
- 流程引擎模型总结
- program/code optimization
- 自适应的导航条
- TCP、UDP区别以及TCP传输原理、拥塞避免、连接建立、连接释放总结
- POJ 1269 Intersecting Lines(计算几何)
- Linux内核升级
- MRC下block循环嵌套暴露的内存问题
- 学习排序算法1
- apache虚拟主机配置
- leetcode----Combinations