optimizeit v1.0.4
OptimizeIt
OptimizeIt is a tool that is meant to help you Optimize your code. You simply run this command-line application and give it a source code file name which it then optimizes for peak performance and readability.
If you'd like to see more, here is a link to a thorough Demo.
If you'd like to read more about how this project was approached, feel free to check out my Blog Post.
Installation
npm install -g optimizeitHow to use
You can use some of the examples that already exist:
optimizeit examples/main.cpp
optimizeit examples/main.cpp examples/main.pyOr you can run it using one of your own files placed in the root directory, or any other directory you might make:
optimizeit test.py
optimizeit test.py examples/main.cppor
optimizeit newDirectory/index.html
optimizeit newDirectory/index.html styles.css examples/main.pyDifferent Flags
OptimizeIt supports several flags:
Version info
This flag prints the current version of OptimizeIt and the name of the tool, usage:
optimizeit --version
optimizeit -vHTML
This is a great feature which generates a changes.html html file in the output directory (creates one if none exists), displaying side-by-side the before and after of each processed file, usage:
optimizeit file1 --html
optimizeit file1 file2 --htmlMarkdown
This is a nifty feature, where optimizeit creates a changes.md file for you in the output directory (creates one if none exists), displaying the before and after of every file provided after execution, usage:
optimizeit file1 --markdown
optimizeit file1 file2 --markdown
optimizeit file1 -md
optimizeit file1 file2 -mdOutput
This creates an output folder in the current directory, if it doesn't exist, then it creates a file in the output folder containing all the changes, you may provide more than 1 output file per file given, usage:
optimizeit file1 --output file1
optimizeit file1 file2 --output file1 file2
optimizeit file1 -o file1
optimizeit file1 file2 -o file1 file2Model
This specifies the model name that OptimizeIt uses, you may choose any model name from groq, usage:
optimizeit file1 --model model_name
optimizeit file1 file2 --model model_name
optimizeit file1 -m model_name
optimizeit file1 file2 -m model_nameTemperature
This specifies the temperature of the model that OptimizeIt is using, you may specify values from 0.1 to 2.0 although, the higher the temperature the more hallucinations, usage:
optimizeit file1 --temperature 0.1
optimizeit file1 file2 --temperature 0.1
optimizeit file1 -t 0.1
optimizeit file1 file2 -t 0.1API Key
This allows you to set your own groq api key for OptimizeIt to use! This can be very helpful with pay-gated models that groq provides, usage:
optimizeit file1 --api-key your_api_key
optimizeit file1 file2 --api-key your_api_key
optimizeit file1 -a your_api_key
optimizeit file1 file2 -a your_api_keyHelp
This flag displays all of the details and configurations that OptimizeIt has, usage:
optimizeit --help
optimizeit -hToken Usage
This flag allows you print the completion token, prompt token, and total token that OptimizeIt is using from your prompt, usage:
optimizeit file1 --token-usage
optimizeit file1 file2 -uDirectory
This flag is very helpful if you want to optimize all files in a given directory, rather than specify them one by one. OptimizeIt will parse through every file that exists in the directory, and if the file can be Optimized, it will optimize it, usage:
optimizeit -d examples
optimizeit --dir ./examplesThis can also be conveniently combined with other flags, i.e.:
optimizeit -d examples --htmlTOML config
Optimizeit supports reading a .toml config file in the user's home directory to use as option flags when provided.
Create a .optimizeit-config.toml file in the home directory, and provide options to use.
Currently supports the following options:
# model <string>: Specify the model name to use
model = "model-name"
# temperature <number>: Set model temperature (0.1 to 2)
temperature = 0.5
# apiKey <string>: Provide your API key
apiKey = "your-api-key"
# output: Specify output file(s) to save changes
output = ["test1.cpp", "test2.cpp", "test3.cpp"]
# markdown <boolean>: Generate a markdown file with all changes
markdown = true
# html <boolean>: Generate an HTML file with all changes
html = true
# tokenUsage <boolean>: Get token usage information
tokenUsage = trueNOTE: apiKey still must be provided either through .env, command-line argument, or .optimizeit-config.toml. The rest are all optional.