IRC logs for #buildstream for Saturday, 2020-05-30

*** Reagan5616 has joined #buildstream00:33
*** Reagan5616 has quit IRC00:35
*** tristan has quit IRC06:15
*** tristan has joined #buildstream06:28
*** tristan has quit IRC07:00
*** tristan has joined #buildstream07:01
*** ChanServ sets mode: +o tristan07:21
tristanjuergbi, looking at doing the `link` element thing now... what I'm thinking is that from the loader perspective, I need to resolve links at any of their usage points; which is to say: at the moment we call get_loader() we need to discover a link and resolve it immediately, and the same goes for when we traverse dependencies in loader._load_file()07:21
tristanIntuitively one might think we could do this at a single location, but the various stages of load states appears to prevent this (e.g. at first they are nodes, then MetaElements, then Elements)07:22
tristanWe cannot just do a substitution and load multiple MetaElements pointing to the same file07:22
juergbitristan: can't we actually reuse the same MetaElement?07:23
tristanHmm07:23
tristanWell yes that would be the result07:23
juergbii.e., resolve early once and then the link is irrelevant07:23
tristanWe'd still have to special case links along the way, I think07:23
juergbioutside the loader?07:24
tristanNo07:24
juergbiok and in the loader probably not in more places than we special case junction07:24
tristanBut for both cases, at the time of asking for a junction (evaluating the junction.bst), and before getting a file to load (when looping over dependencies and calling _load_file())07:25
juergbii.e., we have two special case instead of one but in the same places, right?07:25
tristanRight07:25
tristanI think there is an overhead too here to using a link if I'm not mistaken07:25
tristanIt might pay off to cache the link resolutions07:25
tristanOtherwise we load the file and resolve every time anything *refers* to a link07:25
juergbithat's true, we should try to avoid that07:26
juergbiespecially as link .bst files might have conditionals, i.e., they aren't always just two yaml nodes07:26
tristanIndeed07:26
juergbibut I guess that also holds for junction links07:26
juergbii.e., not that different from supporting links only for junctions, afaict07:27
tristanUmmm, compared to the current junction "targets" implementation you mean ?07:28
tristanThat's certainly different I think, it's resolved only once07:28
tristanSo, I suppose Loader would gain a new _links dictionary to store resolved link Elements (not MetaElements)07:28
tristanThe `link` Elements would then be used to redirect things at load time07:29
tristanThere will be an additional node.get_str('kind') == 'link' check for every dependency07:29
juergbiright, at the moment we store a dict from junction name to loaders and we need a new dict from link name to target07:30
tristanRight perhaps no need to keep the loaded Element in context, loading the Element is just a formality of accessing the loaded target, and exercising assertions like BST_FORBID_SOURCES etc07:31
tristaneither way, we're only interested in caching the target07:31
juergbitristan: maybe add a target attribute to LoadElement?07:32
tristanThen still, for every access to any element, there would still be a preemptive check to try to fetch the target from the _link cache (even if it's been resolved once)07:32
juergbias we already have a dict for that, avoiding an extra lookup07:32
tristanI'm not sure I follow07:32
juergbitristan: in _load_file() we currently do a lookup for every dependency in self._elements07:34
juergbithese are LoadElement instances07:34
tristanSo we have an `_elements` cache of LoadElements, you would have the loaded `link` cached as a LoadElement with a target member... not sure where it's leading07:35
* tristan doesnt think he likes the data model this way either07:35
tristanRight07:35
juergbimaybe when resolving a link, we could add an extra entry to self._elements where we directly point to the target LoadElement07:35
tristanMhm07:35
juergbiso the next time the link is specified as dependency, we directly get the target07:35
tristanAh07:35
juergbiit's been a while since looking at loader code, so I might be overlooking something07:35
tristanAnd, same for `_loaders` ?07:36
tristanI do see where you're going now07:36
juergbiyes, I think so. _loaders for junction links and _elements for regular element links07:36
tristanOne hash lookup + member access vs 2 hash lookups07:36
juergbiand it might even be less code07:36
tristanOk lets try and see :)07:37
juergbithe performance difference might not actually be significant compared to YAML processing07:37
juergbiso code legibility is probably higher priority07:37
juergbibut if it's fast and simple code, even better :)07:38
tristanYeah, the loader is not the most legible of territories07:38
tristaninterestingly, junctions are also cached in _elements as LoadElements08:11
tristanHmmm, this is working nicely09:32
tristanOnly one test written, I'll have to add a bunch of tests, still have to implement for elements, and then remove the whole `target` junction feature separately in the same branch09:33
tristanBut looks like it will be more legible as a result09:33
tristanwhoa that loop in _load_file() is really a mind bender :-S11:29
tristanSo when we load a dependency across a junction, it's okay to recurse, but not when loading dependencies within the same project ?11:35
* tristan doesnt understand 17144d84c2 ... why can the exact same thing not be achieved without adding this extra _NO_PROGRESS variable, which I think None is a perfectly good value for ?12:12
tristannewsflash: `if foo:` truthy statements fail pylint when `foo` is defined in cython as readonly; pylint says this is "Using a conditional statement with a constant value (using-constant-test)"13:00
tristanthis gets swept under the rug when changing it to `if foo is not None:`, which might be an explanation for the suspiciously growing number of `is not None` statements in our code13:01
*** Valentina2055 has joined #buildstream13:21
*** Valentina2055 has quit IRC13:22
*** Gianna6275 has joined #buildstream13:56
*** slaf has quit IRC13:56
*** slaf has joined #buildstream13:57
*** Gianna6275 has quit IRC13:57
*** jswagner has quit IRC13:58
*** tristan has quit IRC14:43
*** Genesis5882 has joined #buildstream14:50
*** Genesis5882 has quit IRC14:52
*** tristan has joined #buildstream15:17
*** tristan has quit IRC15:38
*** philn has quit IRC15:38
*** phildawson has quit IRC15:38
*** traveltissues has quit IRC15:38
*** chipb has quit IRC15:38
*** SotK has quit IRC15:38
*** lantw44 has quit IRC15:38
*** Trevinho has quit IRC15:38
*** chipb has joined #buildstream15:38
*** tristan has joined #buildstream15:38
*** philn has joined #buildstream15:39
*** traveltissues has joined #buildstream15:39
*** phildawson has joined #buildstream15:39
*** Trevinho has joined #buildstream15:40
*** SotK has joined #buildstream15:40
*** phildawson has quit IRC19:23
*** phildawson has joined #buildstream19:23
*** Ava4991 has joined #buildstream21:12
*** Ava4991 has quit IRC21:13
*** phildawson has quit IRC21:18
*** jswagner has joined #buildstream22:12
*** jswagner has joined #buildstream22:13
*** jswagner has joined #buildstream22:14
*** Ella3089 has joined #buildstream23:14
*** Ella3089 has quit IRC23:16

Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!