I’m sitting here at my parents house (I wanted to beat the snow for the holidays) working on the document that will guide the development of the new invoke module for PyGI. To start I attacked it from a very high level, idealistic standpoint where we could both modularize and optimize the code all in one sweeping iteration over the GI function arguments.
Of course I knew there would be edge cases and a few places where the model needed to be tweaked. As I dived more and more into the details (I’m designing the caching layer right now) I realized there isn’t enough information in GI to completely get rid of processing my own metadata, nor are the args guaranteed to be able to be processed linearly. For instance most library init functions take argc (array length) before argv (the array). Of course this isn’t to say that GI and the typelibs are not complete. They are more than complete, just that we haven’t normalized the state machine.
This all necessitates a metadata sorting loop which begs the question, why don’t we just combine that with the cache and state initialization layers and then just loop over the in args during the in validation and marshalling layer? We could for a majority of in arguments, process them in the metadata loop but for the few edge cases that break the model, it would mean separate code paths and increased complexity.
The truth is even though paper is entitled Speeding Up Invoke, my real goals are to fully understand what was going on under the hood while explaining it to others and to modularize the code so it is easier to understand (and optimize) going forward. In any case almost anything we do will be an improvement over the multiple times we call into the GI library for the same data in one invoke call. By producing a roadmap and breaking the code into smaller chunks, more people will be able to look at the code and provide optimization, feature and stability fixes. Actually the way things are laid out in the paper we will already fix some of the limitations such as simplified argument counting which allow optional user_data values, multiple callback support, and multiple lists/arrays referencing one length in value (see clutter_actor_animatev for an example).
The good news is once I fully flesh out the paper implementing it should take a couple of days. Most of it is just rearranging code. I hope to get to it before the hackfest in the middle of January.
[read this post in: ar de es fr it ja ko pt ru zh-CN ]