Author brandtbucher
Recipients Dennis Sweeney, brandtbucher, rhettinger
Date 2021-06-02.01:38:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Seems like a good idea as long as we're careful about the implementation. I've just jotted down a few notes here:

- We should probably break the table upon encountering a guard.

- We probably can't get away with storing a dictionary in the code object's constants, since the entire code object needs to be hashable. We could store a tuple of key-value pairs and either (a) build the dictionary each time we enter the block, or (b) stash it somewhere. If we stash it:
  - Should we defer building it until the first time we hit the block, or earlier than that?
  - Where would we stash it?

- We should probably have some heuristic perhaps more restrictive than "two or more of the following in a row". I'm not entirely sure that loading/building a dictionary, hashing an integer/string/None, looking it up in a dictionary, and then either (a) recovering from the error, or (b) converting the Python integer value into a C long and jumping on it is faster than the current implementation for the first two cases. I know it's really fast, but I'm not *sure* it will be an obvious win yet. Ideally, the best-case scenario (match on first case) would be just as fast as it is currently. I'm probably willing to speed up the average case at the expense of the best case, though.

- I'm not sure we need to limit this to leading cases. What's stopping us from having one of these jump tables in the middle of a match block (or even having more than one scattered throughout)? Unless I'm missing something, this should work anytime we observe contiguous "simple" cases.
Date User Action Args
2021-06-02 01:38:43brandtbuchersetrecipients: + brandtbucher, rhettinger, Dennis Sweeney
2021-06-02 01:38:43brandtbuchersetmessageid: <>
2021-06-02 01:38:43brandtbucherlinkissue44283 messages
2021-06-02 01:38:42brandtbuchercreate