publicodes / tools

Set of utility functions to write tooling for Publicodes models
https://publicodes.github.io/tools/
MIT License
8 stars 0 forks source link

Perf(optims): improve perfs #22

Closed EmileRolley closed 1 year ago

EmileRolley commented 1 year ago

Partially fixes https://github.com/incubateur-ademe/nosgestesclimat/issues/1812 by removing $SITUATION rules from references and only evaluating needed rules.

Perf

The compiled publicodes model specs:

The machine specs:

CPU(s):                  8
  On-line CPU(s) list:   0-7
Vendor ID:               GenuineIntel
  Model name:            Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
    CPU family:          6
    Model:               142
    Thread(s) per core:  2
    Core(s) per socket:  4
    Socket(s):           1
    Stepping:            10
    CPU max MHz:         3400,0000
    CPU min MHz:         400,0000
Caches (sum of all):     
  L1d:                   128 KiB (4 instances)
  L1i:                   128 KiB (4 instances)
  L2:                    1 MiB (4 instances)
  L3:                    6 MiB (1 instance)

Previous version

Command Mean [s] Min [s] Max [s] Relative
yarn run compile:rules 33.891 ± 0.243 33.500 34.098 7.51 ± 0.10
yarn run compile:rules -o FR 7.971 ± 0.099 7.880 8.142 1.77 ± 0.03
yarn run compile:rules -o FR -t fr 4.516 ± 0.051 4.428 4.570 1.00

Current version

Command Mean [s] Min [s] Max [s] Relative
yarn run compile:rules 27.471 ± 1.051 25.158 28.470 6.85 ± 0.29
yarn run compile:rules -o FR 7.432 ± 0.109 7.270 7.648 1.85 ± 0.04
yarn run compile:rules -o FR -t fr 4.011 ± 0.070 3.904 4.083 1.00