Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create optimizations.md #305

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added files/optimize.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions practices/optimizations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
slug: optimizations
stages:
- development
short_description: Optimization is the process of modifying a software system to make some aspect of it work more efficiently or use fewer resources
tags:
- optimizations
- code coverage
keywords:
- code - quality
- merge
- testing
- codebase
---

# Optimizations

**TL;DR**

Optimization is an process or methodolgy that is used to make something(for instance any program) to run faster(making it effective) while fulfilling its functionality normally.


## What Is an Optimization
The code optimization in the synthesis phase is a program transformation technique,in which the intermediate code is tend to be improved and thus will be consuming fewer resources (i.e. CPU, Memory), hence faster-running machine code will result.

![Optimization](/files/optimize.jpeg)
[Spconinc.com](https://www.spconinc.com/cerner-millennium-implementation-optimization-support/)


## Why You Might Want the Optimization

ng29 marked this conversation as resolved.
Show resolved Hide resolved
Optimization overall helps to achieve the same goal with lower consumption of resources hence this practice should be followed.
So optimization helps to:

- High compilation speed and low consumption of space.
- Code optimizers are used to avoid overburn of manual optimization as it involves a lot of time.
- Re-usability can be achieved while following optimization.

## How to Implement the Optimization
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, go more into how to implement optimization. I see that you have seen the https://www.thegeekstuff.com/2015/01/c-cpp-code-optimization/ based on the similarities. The article you use goes into C++ optimization, however, the scope of this article should go more into general techniques for optimization. Not only the code but also architecture as is mentioned in the corresponding issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need your help on this

Copy link
Contributor

@ridlees ridlees Oct 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, how I can help you?

Copy link
Contributor

@ridlees ridlees Oct 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ng29, how can I help you with this?

1. **Optimize your Code using Appropriate Algorithm**
2. **Optimize Your Code for Memory**
4. **Using Operators** : Most basic operations like +=, -=, and *=, when applied on basic data types could slow down the program as well.
5. **Problems with Functions** : For example, if you have a code like this, it might be a bad thing.
```
for(int i=1; i<=10; ++i)
DoSomething(i);
```
6. **Optimizing Loops**
7. **Data Structure Optimization**

## Common Pitfalls of the Optimization

ng29 marked this conversation as resolved.
Show resolved Hide resolved
- Bigger code base is the major problem faced due to time based optimizations.
- Chances to improve and make code run faster never ends hence making Performance optimization a never-ending process.
- Coding standards are compromised sometimes to achieve optimization.

## Resources for the Optimization
- Wikipedia: [Program Optimizations](https://en.wikipedia.org/wiki/Program_optimization)
- Einfochips: [ Goals of Optimization](https://www.einfochips.com/wp-content/uploads/resources/a-practical-approach-to-optimize-code-implementation.pdf)
- The Geek Stuff: [ Optimization Tips](https://www.thegeekstuff.com/2015/01/c-cpp-code-optimization/)