[issue28800] Add RETURN_NONE bytecode instruction

2016-11-28 Thread STINNER Victor
STINNER Victor added the comment: Sorry, I didn't want to bother you. I should run the benchmark *before* opening an issue next time :-) I agree that the speedup is negligible, so it's not worth it. The main purpose of the patch was an optimization. I close the issue. Thanks ;-) --

[issue28800] Add RETURN_NONE bytecode instruction

2016-11-28 Thread Yury Selivanov
Yury Selivanov added the comment: -1; we have too many opcodes already. Let's not complicate the code if there's no performance improvement. -- nosy: +yselivanov ___ Python tracker

[issue28800] Add RETURN_NONE bytecode instruction

2016-11-27 Thread Tim Peters
Tim Peters added the comment: I also don't see a good reason to keep this open now - adds complication for no quantifiable payoff. -- ___ Python tracker

[issue28800] Add RETURN_NONE bytecode instruction

2016-11-27 Thread Brett Cannon
Brett Cannon added the comment: My vote is to close this issue since the performance isn't panning out. -- nosy: +brett.cannon ___ Python tracker ___

[issue28800] Add RETURN_NONE bytecode instruction

2016-11-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: When we added LIST_APPEND (the first of the custom opcodes intended for optimization), it was done only because it was frequently used in inner loops where it provided real benefits to users. In contrast this opcode seems like a waste. Historically for

[issue28800] Add RETURN_NONE bytecode instruction

2016-11-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The pair LOAD_CONST/RETURN_VALUE is on 19th place of the top of opcode pairs (see msg269391 in issue27255). Not all of these constants are None. And since the time of LOAD_CONST is much smaller then the time of RETURN_VALUE (the latter includes destroying a

[issue28800] Add RETURN_NONE bytecode instruction

2016-11-25 Thread STINNER Victor
STINNER Victor added the comment: > Do you want to add RETURN_NONE or RETURN_CONST? Or both? Only RETURN_NONE because on some corner cases it allow to avoid completely the None constant from code.co_consts and reduce the stack size. I'm not sure that I want to start taking the same road of

[issue28800] Add RETURN_NONE bytecode instruction

2016-11-25 Thread STINNER Victor
STINNER Victor added the comment: Results of performance 0.5.0 on speed-python: haypo@speed-python$ python3 -m perf compare_to -G --min-speed=3 2016-11-23_19-34-default-3d660ed2a60e.json patch.json Slower (3): - spectral_norm: 265 ms +- 2 ms -> 277 ms +- 7 ms: 1.04x slower -

[issue28800] Add RETURN_NONE bytecode instruction

2016-11-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Do you want to add RETURN_NONE or RETURN_CONST? Or both? Adding new special opcodes can decrease the size of the code and increase performance of some cases. But it adds maintenance burden, increases the complexity of the compiler and peephole optimizer,

[issue28800] Add RETURN_NONE bytecode instruction

2016-11-25 Thread STINNER Victor
STINNER Victor added the comment: I'm proposing this patch because I noticed that reducing the number of opcodes makes Python faster in my old registervm project: a fork of CPython which uses a register-based bytecode: http://faster-cpython.readthedocs.io/registervm.html I also plan to

[issue28800] Add RETURN_NONE bytecode instruction

2016-11-25 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- components: +Interpreter Core nosy: +rhettinger stage: -> patch review type: -> enhancement ___ Python tracker

[issue28800] Add RETURN_NONE

2016-11-25 Thread STINNER Victor
New submission from STINNER Victor: Attached patch adds a new bytecode instruction: RETURN_NONE. It is similar to "LOAD_CONST; RETURN_VALUE" but it avoids the need of adding None to constants of the code object. For function with an empty body, it reduces the stack size from 1 to 0. Example

[issue28800] Add RETURN_NONE bytecode instruction

2016-11-25 Thread STINNER Victor
Changes by STINNER Victor : -- title: Add RETURN_NONE -> Add RETURN_NONE bytecode instruction ___ Python tracker ___