[issue33955] Implement PyOS_CheckStack on macOS using pthread_get_stack*_np
Dong-hee Na
report at bugs.python.org
Mon Jul 2 15:00:13 EDT 2018
Dong-hee Na <donghee.na92 at gmail.com> added the comment:
@ronaldoussoren
I updated the PR and we need some discussion.
I benchmarked new patch with Fibonacci codes.
baseline(master): 21.330535484
without call sysctlbyname(PR 8046): 22.857963209 secs
with call sysctlbyname(PR 8046): 37.125129114 secs
So my choice is just believe pthread_get_stacksize_np() like rust do. (https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/thread.rs#L246)
code:
def fib(n):
if n == 0:
return 0
if n == 1:
return 1
return fib(n-2) + fib(n-1)
if __name__ == '__main__':
import timeit
print(timeit.timeit("fib(10)", setup="from __main__ import fib"))
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33955>
_______________________________________
More information about the Python-bugs-list
mailing list