npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

optimizeit

v1.0.4

Published

OptimizeIt is a command-line tool that automatically optimizes source code for performance and readability, supporting multiple programming languages and configurable settings.

Downloads

51

Readme

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.

ezgif-4-f1aeeea586

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 optimizeit

How to use

You can use some of the examples that already exist:

optimizeit examples/main.cpp
optimizeit examples/main.cpp examples/main.py

Or 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.cpp

or

optimizeit newDirectory/index.html
optimizeit newDirectory/index.html styles.css examples/main.py

Different 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 -v

HTML

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 --html

Markdown

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 -md

Output

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 file2

Model

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_name

Temperature

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.1

API 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_key

Help

This flag displays all of the details and configurations that OptimizeIt has, usage:

optimizeit --help
optimizeit -h

Token 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 -u

Directory

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 ./examples

This can also be conveniently combined with other flags, i.e.:

optimizeit -d examples --html

TOML 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 = true

NOTE: apiKey still must be provided either through .env, command-line argument, or .optimizeit-config.toml. The rest are all optional.