Xavier-Do de077243ef [IMP] profiling: enable nested Execution context
The initial behaviour of ExecutionContext was to
- add the context for the current level of the stack on enter
- remove the context at this same level on exit.

When two ExecutionContext are nested at the same stack level:
- the first one adds it's context;
- the second one overrides the current context;
- the second one removes it at the end;
- the first one fails to remove the context at the same level a second time.

    def call():
        with ExecutionContext(foo=1):
            with ExecutionContext(bar=2):
                execute()

In this case we could imagine to combine both Execution managers in one:

    def call():
        with ExecutionContext(foo=1, bar=2)
            execute()

But the semantics is different: ExecutionContext should add one level to
the stack, instead of two.  In the first example above, we expect two
additionnal levels:

    call
    foo=1
    bar=2
    execute

A simple solution would be to transform the value of the context at some
level to a list of dict, but this would make the copy more difficult.
The decision was taken to change the context storage strategy, going
from a dict where the keys are the level to a tuple of tuples where the
first element is the level.

    {3: {foo: 1}, 4: {bar: 2}} =>  ((3, {foo: 1}), (4, {bar: 2}))

The first benefit is to allow multiple contexts at the same level.  The
second one is that we don't need to copy the data structure, since
tuples are immutables and the dicts are coming from kwargs.  This means
that saving the context is faster, and the tuple is shared between
multiple samples.  This is interesting if we assume that we do more
samples than exec_context mutations.

closes odoo/odoo#75687

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2021-08-30 13:28:05 +00:00
2021-08-16 15:19:30 +00:00
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%