Skip to content
Snippets Groups Projects
  • Val Lorentz's avatar
    cb8e274c
    Speedup tests by caching HomeServerConfig instances (#15284) · cb8e274c
    Val Lorentz authored
    These two lines:
    
    ```
    config_obj = HomeServerConfig()
    config_obj.parse_config_dict(config, "", "")
    ```
    
    are called many times with the exact same value for `config`.
    
    As the test suite is CPU-bound and non-negligeably time is spent in
    `parse_config_dict`, this saves ~5% on the overall runtime of the Trial
    test suite (tested with both `-j2` and `-j12` on a 12t CPU).
    
    This is sadly rather limited, as the cache cannot be shared between
    processes (it contains at least jinja2.Template and RLock objects which
    aren't pickleable), and Trial tends to run close tests in different
    processes.
    Speedup tests by caching HomeServerConfig instances (#15284)
    Val Lorentz authored
    These two lines:
    
    ```
    config_obj = HomeServerConfig()
    config_obj.parse_config_dict(config, "", "")
    ```
    
    are called many times with the exact same value for `config`.
    
    As the test suite is CPU-bound and non-negligeably time is spent in
    `parse_config_dict`, this saves ~5% on the overall runtime of the Trial
    test suite (tested with both `-j2` and `-j12` on a 12t CPU).
    
    This is sadly rather limited, as the cache cannot be shared between
    processes (it contains at least jinja2.Template and RLock objects which
    aren't pickleable), and Trial tends to run close tests in different
    processes.