Created on 2018-03-17 12:33 by Mark.Shannon, last changed 2022-04-11 14:58 by admin.
Pull Requests |
|
|
|
URL |
Status |
Linked |
Edit |
PR 6132 |
open |
Mark.Shannon,2018-03-17 13:02 |
|
Messages (7) |
|
|
msg314000 - (view) |
Author: Mark Shannon (Mark.Shannon) *  |
Date: 2018-03-17 12:33 |
f-string expressions can be formatted in four ways: with or without a conversion and with or without a format specifier Rather than have one bytecode that parses the opcode argument at runtime it would be more efficient and produce a cleaner interpreter for the compiler to produce one or two bytecode as required. The bytecodes should be: CONVERT_VALUE convert_fn FORMAT_SIMPLE FORMAT_WITH_SPEC For simple format expressions with no conversion or format specifier, which make up about 3/4 of all format expressions in the standard library, just the bytecode FORMAT_SIMPLE need be executed. |
|
|
msg314001 - (view) |
Author: Eric V. Smith (eric.smith) *  |
Date: 2018-03-17 12:40 |
Would this change really have a performance impact? Not saying it wouldn't, but if we're going to add bytecodes we should know the answer in advance. |
|
|
msg314004 - (view) |
Author: Mark Shannon (Mark.Shannon) *  |
Date: 2018-03-17 13:05 |
Even if doesn't speed things up by a significant amount, I would suggest that a simper interpreter with smaller, simpler bytecodes is a worthy goal in itself. |
|
|
msg314312 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2018-03-23 16:32 |
> I would suggest that a simper interpreter with smaller, simpler bytecodes is a worthy goal in itself. +1 from me. Though I'm curious about performance changes as well :-) |
|
|
msg314317 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2018-03-23 17:18 |
I wouldn't say this more efficient. Instead one instruction you would need to execute two instructions. If I implemented f-string formatting I would add four simple opcodes for str(), repr(), ascii() and format(). But Eric merged them all in the single opcode with complex argument. While this looks more complicated and less extensible, it is more efficient. |
|
|
msg322379 - (view) |
Author: Tal Einat (taleinat) *  |
Date: 2018-07-25 17:57 |
Mark, since you have a working version of this, perhaps you can supply some performance benchmark results to help in making a decision? |
|
|
msg400348 - (view) |
Author: Mark Shannon (Mark.Shannon) *  |
Date: 2021-08-26 14:31 |
No significant change in performance https://gist.github.com/markshannon/34a780d65e69b5a573a83f3fdb0139aa I think this merely indicates that there are little to no f-strings in the pyperformance benchmark suite. |
|
|
History |
|
|
|
Date |
User |
Action |
Args |
2022-04-11 14:58:58 |
admin |
set |
github: 77273 |
2021-08-26 14:31:11 |
Mark.Shannon |
set |
messages: + |
2018-07-25 17:57:39 |
taleinat |
set |
nosy: - taleinat |
2018-07-25 17:57:24 |
taleinat |
set |
nosy: + taleinatmessages: + |
2018-03-23 17🔞04 |
serhiy.storchaka |
set |
nosy: + serhiy.storchakamessages: + |
2018-03-23 16:32:47 |
pitrou |
set |
nosy: + pitroumessages: + |
2018-03-17 13:05:29 |
Mark.Shannon |
set |
messages: + |
2018-03-17 13:02:10 |
Mark.Shannon |
set |
keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest5893> |
2018-03-17 12:40:08 |
eric.smith |
set |
nosy: + eric.smithmessages: + |
2018-03-17 12:33:10 |
Mark.Shannon |
create |
|