[pmg-devel] applied: [PATCH] panel/acme-domains: fix cyclic dependency in view model

Dominik Csapak d.csapak at proxmox.com
Wed Mar 24 08:31:39 CET 2021


On 3/24/21 08:21, Thomas Lamprecht wrote:
> On 23.03.21 19:22, Dietmar Maurer wrote:
>>> So, if on evaluation a get(X) is missed due to it being not always called,
>>> like with boolean statements where a single truthy is enough for an or expression
>>> like above, that data dependency is lost and one may see bug like behaviour.
>>>
>>> Use intermediate variables to combat that, for example, above `accountValueHidden`
>>> formula should read:
>>>
>>> accountValueHidden: (get) => {
>>>      let editable = get('accountEditable'), available = get('accountsAvailable');
>>>      return !editable || !available;
>>> },
>>
>> I guess a good JIT can still optimize that away?
>>
> 
> 
> You're right, that may be the case.
> Albeit, I guess that for such short method where the JS engine cannot know if it is
> a "hot" function (lots calls) so the JIT won't be used initially, and the interpreter
> probably isn't smart enough to detect this optimization.
> 
> At least above approach helped a bit ago when I ran in such a bug, but yeah, it may
> not be really future proof...
> 
> 

but AFAIR, extjs actually parses the function *text* to find the
data dependencies (see 
https://docs.sencha.com/extjs/6.0.1/classic/src/Formula.js.html)

and i hope that the JIT does not change the text of the function
at all....




More information about the pmg-devel mailing list