Open krackers opened 1 year ago
Found a way to reduce time of builtin.eval
. Python can precompile string to bytecode, with compile
which can be passed to eval
. Doing this basically optimizes as much as possible I think, only remaining is translate_preset_variables
and string_splitter
which is going to be unavoidable. Maybe one could optimize by seeing if the variable is used in the expression first, but I don't really know if that would be any faster.
Great! Thank you. I’ll check out tomorrow.
T
On Tue, Jan 9, 2024 at 7:14 PM krackers @.***> wrote:
Found a way to reduce time of builtin.eval. Python can precompile string to bytecode, with compile which can be passed to eval. Doing this basically optimizes as much as possible I think, only remaining is translate_preset_variables and string_splitter which is going to be unavoidable
— Reply to this email directly, view it on GitHub https://github.com/thepyedpiper/pyp/issues/6#issuecomment-1884124835, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYBHA75WL673NCDZYRZT3STYNYBSDAVCNFSM6AAAAAA37OBJQSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBUGEZDIOBTGU . You are receiving this because you are subscribed to this thread.Message ID: @.***>
shows a lot of time (~20 out of 28 seconds) is spent in
string_splitter
. Some of this might be unavoidable due to python slowness, but I wonder if there's some cleverness we can do to avoid such heavy performance?The slowdown is the particular line
It's not clear to me what exactly it's doing. If that is removed, then we get the following heavy hitters: