GithubHelp home page GithubHelp logo

wasi-master / fastero Goto Github PK

View Code? Open in Web Editor NEW
236.0 3.0 6.0 6.92 MB

Python timeit CLI for the 21st century! colored output, multi-line input with syntax highlighting and autocompletion and much more!

Home Page: https://fastero.readthedocs.io

License: MIT License

Python 100.00%
benchmark benchmarking python python-benchmark python-benchmarks python3 timeit fastero python-timeit pyperf

fastero's Introduction

fastero

Python timeit CLI for the 21st century

Read the Documentation

Installation & Usage

Install either with pipx or pip. Both work, use what you want. Or optionally you can install from github using pip install git+https://github.com/wasi-master/fastero

For usage please check out the documentation

Features

For more info on all of these features, please the documentation

  • 🌟 Beautiful formatted, and colored output. Output is reminiscent of hyperfine
  • 🀯 Amazing exporting options
    • πŸ“Š Export as a bar plot with matplotlib
    • πŸŒƒ Export as a beautiful image with the console output
    • ℹ️ Export as Markdown, HTML, CSV, AsciiDoc tables
    • πŸ’Ύ Export as JSON and YAML data to use them elsewhere
      • πŸ” You can also import the JSON data later within fastero to re-run the benchmark with the same parameters or to export the data again with different parameters.
  • πŸš€ Extremely intuitive and easy to use.
  • πŸ”’ Benchmark multiple snippets
    • πŸ”€ Assign a name to each snippet to make it easier to distinguish
    • πŸ“ˆ Get nice statistics about the each of the snippet and a summary on how fast each of them are compared to each other
  • ↩ Enter multiline code in an input with syntax highlighting and amazing autocomplete
  • ⏰ Excellent time parsing. Inputs like 500ms, 10s, 1m5s, 1.5m, 1h30m15s, etc. work flawlessly
  • πŸ”₯ Run a few times without timing with the warmup parameter to fill caches and things like that.
  • πŸ‘¨ Customize it to your liking.
    • πŸ”£ Custom time formats e.g. nanoseconds, microseconds, milliseconds, seconds etc.
    • 🎨 Custom theme for code input and/or output.
  • πŸŽ›οΈ Control how long each snippet is benchmarked for
    • πŸ”’ Specify a minimum and a maximum amount of runs to calculate the number of runs automatically based on run duration
    • πŸ”Ÿ Or specify a definite number of runs for manual override
  • πŸ’» Cross-platform.
  • 🀯 Open source.
  • πŸ“š Extensive documentation.

Acknowledgements

  • hyperfine - Inspiration for creating this library and the UI.
  • snappify.io - Inspiration for the Image export.
  • rich - Used for beautiful output

fastero's People

Contributors

imgbotapp avatar wasi-master avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fastero's Issues

[BUG]: Can't install with pipx

Description of the bug

pipx doesn't find any binaries to run in fastero

Steps To Reproduce

  1. pipx run fastero
    Output:
> pipx run fastero
fastero not found in package fastero. Available binaries:

Additional Information

No response

Issue when timing code with a call to global

I tried fastero after listening to the April 28 2022 episode of Python Bytes.

In installed
fastero 0.2.4
python 3.10.4
windows 10.

I wanted to time two functions one that used global and one that didn't.

I made a file - "using_global.py"

R = 8.314

def calling_global():
    global R
    R*10

calling_global()

and a file - "not_using_global.py"

R=8.314

def not_calling_global():
    R*10

not_calling_global()

then at the command line ran:

python -m fastero "file: not_using_global.py" "file: using_global.py"

I received an error

────────────────────────────────────────────────── Benchmark started… ──────────────────────────────────────────────────
Benchmark 1: R = 8.314


def not_calling_global():
    R * 10


not_calling_global()
  Time  (mean Β± Οƒ):       196.1 ns Β±   5.2 ns
  Range (min  … max):     190.9 ns … 204.9 ns    [runs: 14,000,000]
Benchmark 2: R = 8.314


def calling_global():
    global R
    R * 10


calling_global()
Traceback (most recent call last):
  File "C:\Users\XXX\Anaconda3\envs\eos\lib\site-packages\fastero\core.py", line 475, in app
    num_in_one_batch, time_taken = _autorange(timer, autorange_callback)
  File "C:\Users\rlarson\Anaconda3\envs\eos\lib\site-packages\fastero\core.py", line 461, in _autorange
    time_taken = timer.timeit(number)
  File "C:\Users\XXX\Anaconda3\envs\eos\lib\timeit.py", line 178, in timeit
    timing = self.inner(it, self.timer)
  File "<timeit-src>", line 14, in inner
    calling_global()
  File "<timeit-src>", line 11, in calling_global
    R * 10
NameError: name 'R' is not defined

if I run the file "using_global.py" with python I do not get the error related to this file.

python using_global.py

[BUG]: python_diff_between_two_lists_benchmark.sh has two slashes at end unlike other examples

Description of the bug

Open python_diff_between_two_lists_benchmark.sh and note it has \\ as end of lines. That could doesn't work when I paste in a terminal. Whereas the other .sh files in example work.

Steps To Reproduce

Open python_diff_between_two_lists_benchmark.sh and note it has \\ as end of lines. The other .sh files just have single \.

Additional Information

No response

[FEAT]: Update Sphinx config for favicon

Description

Thanks for using Sphinx Favicon in your project! I just released version 1.0 of the extension, which brings one breaking change: to better conform with Python standards, we changed the module name to sphinx_favicon (instead of sphinx-favicon). This means you'll have to update the name in the extensions list of your conf.py file (https://github.com/wasi-master/fastero/blob/main/docs/source/conf.py#L47) before you can use version 1.0. Otherwise, your existing configuration should continue to work!

Additional Information

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.