mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
remove test module timeit
This commit is contained in:
parent
068abe347f
commit
1404b97416
@ -1,8 +0,0 @@
|
||||
---
|
||||
icon: package
|
||||
label: timeit
|
||||
---
|
||||
|
||||
### `timeit.timeit(f, number)`
|
||||
|
||||
Returns the time taken to execute the given function `f` `number` times.
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace pkpy{
|
||||
|
||||
void add_module_timeit(VM* vm);
|
||||
void add_module_operator(VM* vm);
|
||||
void add_module_time(VM* vm);
|
||||
void add_module_sys(VM* vm);
|
||||
|
@ -2,19 +2,6 @@
|
||||
|
||||
namespace pkpy{
|
||||
|
||||
void add_module_timeit(VM* vm){
|
||||
PyObject* mod = vm->new_module("timeit");
|
||||
vm->bind_func<2>(mod, "timeit", [](VM* vm, ArgsView args) {
|
||||
PyObject* f = args[0];
|
||||
i64 iters = CAST(i64, args[1]);
|
||||
auto now = std::chrono::system_clock::now();
|
||||
for(i64 i=0; i<iters; i++) vm->call(f);
|
||||
auto end = std::chrono::system_clock::now();
|
||||
f64 elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - now).count() / 1000.0;
|
||||
return VAR(elapsed);
|
||||
});
|
||||
}
|
||||
|
||||
void add_module_operator(VM* vm){
|
||||
PyObject* mod = vm->new_module("operator");
|
||||
vm->bind_func<2>(mod, "lt", [](VM* vm, ArgsView args) { return VAR(vm->py_lt(args[0], args[1]));});
|
||||
|
@ -1450,7 +1450,6 @@ void VM::post_init(){
|
||||
add_module_gc(this);
|
||||
add_module_random(this);
|
||||
add_module_base64(this);
|
||||
add_module_timeit(this);
|
||||
add_module_operator(this);
|
||||
add_module_csv(this);
|
||||
|
||||
|
@ -533,17 +533,6 @@ assert v.x == 0
|
||||
v.x = 10
|
||||
assert v.x == 10
|
||||
|
||||
# /************ module timeit ************/
|
||||
import timeit
|
||||
|
||||
def aaa():
|
||||
for i in range(10):
|
||||
for j in range(10):
|
||||
pass
|
||||
|
||||
assert type(timeit.timeit(aaa, 2)) is float
|
||||
|
||||
|
||||
# function.__doc__
|
||||
def aaa():
|
||||
'12345'
|
||||
|
Loading…
x
Reference in New Issue
Block a user