You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Of course we initialize KaitaiStream which may not be used, but I guess we expect that in most cases that KaitaiStream is needed. But this nuance can be improved by introducing a dependency (written in C and messing with the interpreter)
I don't think it's that "suboptimal" — i.e. it does not really affect performance. Reading bytes and IO can be factored out, but, technically, even these cases are slightly different — "else" case just reads bytes right into body. If we'll be implementing substreams (#44), there won't be separate self._io.read_bytes + KaitaiStream(BytesIO(self._raw_body)) call, there would be single substream-creating call, they would be even more different.
We can think of something, but probably that won't be a high priority task. At least, I'd wait for #44 to be impemented first.
GreyCat
changed the title
Type selection code may be better
Optimizing switch types parsing by factoring IO creation
Feb 4, 2018
For now for python it generates a bit ugly suboptimal code:
I guess it should look like
Of course we initialize KaitaiStream which may not be used, but I guess we expect that in most cases that KaitaiStream is needed. But this nuance can be improved by introducing a dependency (written in C and messing with the interpreter)
which will instantiate it lazily on the first use. Not sure though if it is compatible with pypy.
The text was updated successfully, but these errors were encountered: