Skip to content

lamtung16/Speed_Compare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python Loop Performance Comparison

This repository contains code to compare the running time of different methods for iterating over a loop in Python. The methods tested include regular loop, parallel processing, built-in functions, NumPy, PyTorch, pandas, and TensorFlow.

Introduction

Loops are a fundamental concept in programming, and the efficiency of iterating over a loop can have a significant impact on the performance of a program. In Python, there are various methods for iterating over a loop, each with its own advantages and disadvantages in terms of performance.

Methods Tested

  1. Regular Loop: Traditional sequential iteration using a for loop.
  2. Parallel Processing: Utilizing parallel processing to distribute the workload across multiple CPU cores.
  3. Built-in Functions: Utilizing built-in functions such as map() or filter() for iteration.
  4. NumPy: Utilizing NumPy arrays for vectorized operations.
  5. PyTorch: Utilizing PyTorch tensors for tensor-based operations.
  6. Pandas: Utilizing pandas DataFrame for data manipulation and iteration.
  7. TensorFlow: Utilizing TensorFlow tensors for tensor-based operations.

Setup

To run the performance comparison tests, follow these steps:

  1. Clone this repository:

    git clone https://github.com/your_username/python-loop-performance.git
  2. Install the required dependencies:

    pip install pandas numpy torch tensorflow

This will execute the performance comparison tests for each method and display the results.

Results

The results of the performance comparison tests will be displayed, showing the execution time for each method. Additionally, the results may vary depending on the input size and complexity of the loop operation.

Contributing

Contributions are welcome! If you have suggestions for additional loop iteration methods to test or improvements to the existing code, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published