[issue44501] Packing constant call arguments

2022-04-06 Thread Batuhan Taskaya
Change by Batuhan Taskaya : -- resolution: -> rejected stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue44501] Packing constant call arguments

2021-07-03 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: > BTW, why do you not fold 2-argument calls? Seems like it is making stuff worse. > I suspect that in most of other examples the function execution time is too > large to make the optimization meaningful. This is (to some extent) a constant folding pass,

[issue44501] Packing constant call arguments

2021-07-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Great! Common examples are str.replace(), re.Match.groups() and __exit__(None, None, None). Common anti-patterns include slice(None, None, None) (why not slice(None)?) and datetime(1970, 1, 1) (it should be a global constant). I suspect that in most of

[issue44501] Packing constant call arguments

2021-07-03 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: > I am still not sure that it is worth to add 50 lines of the C code to > optimize 0.7% of calls. As I stated, the reason that this is 'relatively' lower is that there are just too many calls, so it just allocates a rather small part of the total pie. >

[issue44501] Packing constant call arguments

2021-07-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I am still not sure that it is worth to add 50 lines of the C code to optimize 0.7% of calls. You have found 7 examples of function calls with 3 or 4 constant arguments. Does it include tests? Could you please show several (or several hundreds)

[issue44501] Packing constant call arguments

2021-06-24 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: I've tested this with pyperformance, and no significant (1.02 faster on some, 1.01x slower on others, nothing significant) change on those so this is a targeted optimization. -- ___ Python tracker

[issue44501] Packing constant call arguments

2021-06-24 Thread Batuhan Taskaya
Change by Batuhan Taskaya : -- keywords: +patch pull_requests: +25477 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26901 ___ Python tracker ___

[issue44501] Packing constant call arguments

2021-06-23 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: Here is my branch for the reference (I didn't worked on about it much, so still lacks some error handling etc); https://github.com/isidentical/cpython/blob/b556d1172b08c65b88093f7ff1dadc985ce72f62/Python/ast_opt.c#L634-L698 --

[issue44501] Packing constant call arguments

2021-06-23 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: > I already experimented with this in issue33325. It does not worth an effort. Yea, that is what the results for the CFG optimization shows to me (1.13x at best, ~1.03x in real cases). > For optimizing calls with constant arguments, it looks more

[issue44501] Packing constant call arguments

2021-06-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > folding all contiguous LOAD_CONSTs (within some sort of limit ofc) into a > single tuple load and then adding an UNPACK_SEQUENCE I already experimented with this in issue33325. It does not worth an effort. For optimizing calls with constant arguments,

[issue44501] Packing constant call arguments

2021-06-23 Thread Batuhan Taskaya
New submission from Batuhan Taskaya : It is a common scenario to make calls with only constant arguments (e.g to datetime.datetime/os.path.join/re.match.group/nox.session.run etc) and the bytecode that we currently generate looks like this; f(1,2,3,4,5,6) 1 0 LOAD_NAME