AI Code Optimization Prompts

AI Code Optimization Prompts

15 powerful prompts to help optimize and improve the performance of your code

All Prompts
Python
JavaScript
Web Dev
Database
AI/ML
Python

Optimize a Slow Python Function

Improve execution speed of Python functions

Act as a Python performance expert. Analyze the given Python function and suggest optimizations to improve execution speed.
EXAMPLE USAGE: “Act as a Python performance expert. Optimize this recursive Fibonacci function to run faster without using excessive memory.”
Database

Improve SQL Query Performance

Optimize queries with indexing and restructuring

Act as a database optimization specialist. Optimize a slow SQL query by using indexing, better joins, and query restructuring.
EXAMPLE USAGE: “Act as a database optimization specialist. Optimize this SQL query that takes too long to fetch user order history from a large database.”
Java

Reduce Memory Usage in Java

Optimize memory-intensive Java applications

Act as a Java memory management expert. Identify memory-intensive parts of the given Java code and suggest optimizations to reduce RAM usage.
EXAMPLE USAGE: “Act as a Java memory management expert. Optimize this Java application that frequently runs into ‘OutOfMemoryError’ when handling large datasets.”
JavaScript

Optimize a JavaScript Function

Improve efficiency of slow JavaScript functions

Act as a JavaScript performance expert. Improve the efficiency of a JavaScript function that causes slow page load times.
EXAMPLE USAGE: “Act as a JavaScript performance expert. Optimize this DOM manipulation function that causes rendering delays on a web page.”
WordPress

Reduce WordPress Load Time

Fix caching, image optimization, and database issues

Act as a WordPress performance specialist. Identify and fix issues that are making a WordPress site slow, including caching, image optimization, and database queries.
EXAMPLE USAGE: “Act as a WordPress performance specialist. Optimize this WooCommerce site that loads slowly, especially on product pages.”
React

Optimize a React App

Reduce unnecessary re-renders with memoization

Act as a React performance expert. Identify unnecessary re-renders in a React app and suggest improvements using memoization and efficient state management.
EXAMPLE USAGE: “Act as a React performance expert. Optimize this React component that unnecessarily re-renders every time the user types in an input field.”
Python

Optimize Python Data Processing

Speed up large dataset processing

Act as a data optimization specialist. Optimize a Python script that processes large datasets to run faster while maintaining accuracy.
EXAMPLE USAGE: “Act as a data optimization specialist. Improve this Pandas script that takes too long to clean and analyze a dataset with 10 million rows.”
AI/ML

Optimize a Machine Learning Model

Reduce inference time while maintaining accuracy

Act as an AI/ML engineer. Reduce the inference time of a machine learning model while maintaining its accuracy.
EXAMPLE USAGE: “Act as an AI/ML engineer. Optimize this TensorFlow model that takes too long to make predictions on a real-time video stream.”
Java

Optimize Java for Multithreading

Improve performance using concurrency techniques

Act as a Java concurrency expert. Improve the performance of a Java program using multithreading techniques.
EXAMPLE USAGE: “Act as a Java concurrency expert. Optimize this Java program to use multiple threads for faster data processing.”
Node.js

Optimize API Calls in Node.js

Reduce latency and improve response times

Act as a backend optimization expert. Reduce API call latency and improve response times by optimizing request handling and caching.
EXAMPLE USAGE: “Act as a backend optimization expert. Optimize this Node.js Express API that currently takes too long to respond due to multiple database queries.”
Python

Improve Python Web Scraper Efficiency

Handle large-scale data extraction efficiently

Act as a web scraping expert. Optimize a Python web scraper to reduce delays and handle large-scale data extraction efficiently.
EXAMPLE USAGE: “Act as a web scraping expert. Optimize this Selenium-based scraper that gets blocked by websites and runs too slowly when scraping large amounts of data.”
C++

Optimize a C++ Program

Improve CPU and memory efficiency

Act as a C++ performance engineer. Analyze a C++ program and suggest optimizations for better CPU and memory efficiency.
EXAMPLE USAGE: “Act as a C++ performance engineer. Optimize this image processing program to run faster using parallel processing techniques.”
Web

Reduce Web App Bundle Size

Improve load time by optimizing assets

Act as a web performance expert. Optimize a web app by reducing JavaScript bundle size and improving asset loading speed.
EXAMPLE USAGE: “Act as a web performance expert. Optimize this React web app by reducing the JavaScript bundle size to improve page load speed.”
Python

Optimize Python for GPU Acceleration

Utilize GPU for faster computations

Act as a GPU optimization expert. Modify a Python script to utilize GPU acceleration for faster computations.
EXAMPLE USAGE: “Act as a GPU optimization expert. Optimize this NumPy-based deep learning script to run efficiently on a CUDA-enabled GPU.”
Laravel

Improve Laravel Performance

Optimize queries, caching, and code execution

Act as a Laravel performance expert. Optimize a Laravel application by improving database queries, caching strategies, and code execution.
EXAMPLE USAGE: “Act as a Laravel performance expert. Optimize this Laravel-based e-commerce website that experiences slow response times during high traffic periods.”
Prompt copied to clipboard!