[issue23910] C implementation of namedtuple (WIP)

2015-04-26 Thread Joe Jevnik
Joe Jevnik added the comment: This was very exciting, I have never run gprof before; so just to make sure I did this correctly, I will list my steps: 1. compile with the -pg flag set 1. run the test with ./python -m timeit ... 1. $ gprof python gmon.out > profile.out Here is default: E

[issue23910] C implementation of namedtuple (WIP)

2015-04-27 Thread Joe Jevnik
Joe Jevnik added the comment: I switched to the static tuple. -- Added file: http://bugs.python.org/file39216/with-static-tuple.patch ___ Python tracker <http://bugs.python.org/issue23

[issue23910] C implementation of namedtuple (WIP)

2015-04-27 Thread Joe Jevnik
Joe Jevnik added the comment: I don't think that I can cache the __call__ of the fget object because it might be an instance of a heaptype, and if someone changed the __class__ of the object in between calls to another heaptype that had a different __call__, you would still get the __c

[issue23910] C implementation of namedtuple (WIP)

2015-04-27 Thread Joe Jevnik
Joe Jevnik added the comment: I am currently on a different machine so these numbers are not relative to the others posted earlier. * default ./python -m timeit -s "from collections import namedtuple as n;a = n('n', 'a b c')(1, 2, 3)" "a.a" 100

[issue23910] property_descr_get reuse argument tuple

2015-04-29 Thread Joe Jevnik
Joe Jevnik added the comment: I don't think that we need to worry about reusing the single argument tuple in a recursive situation because we never need the value after we start the call. We also just write our new value and then clean up with a NULL to make sure that we don't blow

[issue28254] Add C API for gc.enable, gc.disable, and gc.isenabled

2016-09-22 Thread Joe Jevnik
New submission from Joe Jevnik: I was writing an extension module that was working with weakrefs and wanted to ensure that the GC would not run for a block of code. I noticed that gc.enable/gc.disable are not exposed to C and the state of the gc is in a static variable so it cannot be mutated

[issue28254] Add C API for gc.enable, gc.disable, and gc.isenabled

2016-09-27 Thread Joe Jevnik
Joe Jevnik added the comment: I definitely could have used PyImport_Import and PyObject_Call to accomplish this task; however, when I looked at at the implementation of these functions it seemed like a lot of overhead and book keeping just to set a boolean. Since I was already in a C

<    1   2