[issue46500] make timeit module accept files

2022-01-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Usually, when you benchmark a non-trivial piece of code, you need also to 
specify a setup code. If the benchmarked code is large enough to be read from a 
file, the setup code should be read from a file too.

The common practice is to write the benchmarked code as a function which can be 
imported and repeatedly executed.

$ python -m timeit -s 'from mybench import test' 'test()'

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46500] make timeit module accept files

2022-01-24 Thread Arjun


Arjun  added the comment:

I was modifying the try/except/finally/else code generation and wanted to run 
my own benchmarks.

It's cumbersome to edit them in a command to test different variations, 
especially when you have to indent.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46500] make timeit module accept files

2022-01-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This module provides a simple way to time small bits of Python code.

What problem are you trying to solve.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46500] make timeit module accept files

2022-01-23 Thread Arjun


Change by Arjun :


--
keywords: +patch
pull_requests: +29026
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30844

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46500] make timeit module accept files

2022-01-23 Thread Arjun


New submission from Arjun :

currently, timeit accepts programs line by line as commandline arguments. 

it would be convenient to give it a program as a file to benchmark.

--
components: Library (Lib)
messages: 411448
nosy: CCLDArjun
priority: normal
severity: normal
status: open
title: make timeit module accept files
type: enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com