Kriskras99 commented on PR #238:
URL: https://github.com/apache/avro-rs/pull/238#issuecomment-3119794594

   I've pushed a (non-functional) prototype for parsing with state machines.
   
   The most interesting thing about this prototype is the use of a "command" 
tape and a "output" tape.
   I created the "command" tape as a replacement for a Schema in the state 
machine, as it's really annoying to keep track of where you are in the Schema 
(lots of `if let Schema::`).
   The "output" tape replaces the Value while the state machine is still 
parsing the input. This has the same reason as not using the Schema. As without 
the schema, the field names are not known (or they could be known but would 
take a lot of space in the "command" tape).
   
   The implementation is far from perfect and there is a lot that could be 
improved. For one, the `ObjectStateMachine` has a lot of duplication going on 
in the `parse` function. I'm pretty sure that duplication can be removed quite 
easily, making it a lot more readable. This implementation also cuts a lot of 
corners, like EOF handling or compression.
   
   I do think it gives a good idea of what it would be like to have the core be 
state machines, wrapped in async and sync wrappers.
   
   I currently only have a sync wrapper, but I'll start on an async wrapper 
just using the `futures` crate which should be compatible with almost all async 
runtimes (either through adapters or directly).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to