dfinity / candid

Candid Library for the Internet Computer
Apache License 2.0
280 stars 81 forks source link

support #[serde(alias)] #567

Closed anchpop closed 2 months ago

anchpop commented 2 months ago

Overview

[serde(alias)] is a very useful attribute for maintaining backwards compatibility when renaming a field.

Requirements

  1. tests
  2. aliases should not show up unornamented in generated .did files

Considerations There should not be any breaking changes, but generated .did files might become slightly less descriptive unless there is a way to automatically add a comment indicating aliases.

github-actions[bot] commented 2 months ago
Name Max Mem (Kb) Encode Decode
blob 4_224 20_459_209 ($\textcolor{green}{-0.00\%}$) 12_083_402 ($\textcolor{red}{0.00\%}$)
btreemap 75_456 4_022_699_168 ($\textcolor{green}{-0.00\%}$) 15_709_219_414 ($\textcolor{red}{0.00\%}$)
nns 192 2_252_618 ($\textcolor{green}{-0.91\%}$) 12_791_445 ($\textcolor{red}{1.24\%}$)
nns_list_proposal 1_792 7_039_172 ($\textcolor{green}{-0.39\%}$) 211_695_242 ($\textcolor{red}{12.84\%}$)
option_list 1_088 ($\textcolor{red}{88.89\%}$) 7_148_425 ($\textcolor{red}{0.10\%}$) 39_122_857 ($\textcolor{red}{20.91\%}$)
text 6_336 20_455_319 ($\textcolor{green}{-0.00\%}$) 17_839_385 ($\textcolor{red}{0.00\%}$)
variant_list 128 7_142_342 ($\textcolor{green}{-0.00\%}$) 24_530_163 ($\textcolor{green}{-0.32\%}$)
vec_int16 16_704 168_582_249 ($\textcolor{green}{-0.00\%}$) 1_073_771_370 ($\textcolor{red}{0.00\%}$)

---------------------------------------------------

Benchmark: blob
  total:
    instructions: 32.54 M (-0.00%) (change within noise threshold)
    heap_increase: 66 pages (no change)
    stable_memory_increase: 0 pages (no change)

  1. Encoding (scope):
    instructions: 20.46 M (-0.00%) (change within noise threshold)
    heap_increase: 66 pages (no change)
    stable_memory_increase: 0 pages (no change)

  2. Decoding (scope):
    instructions: 12.08 M (0.00%) (change within noise threshold)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: text
  total:
    instructions: 38.30 M (-0.00%) (change within noise threshold)
    heap_increase: 99 pages (no change)
    stable_memory_increase: 0 pages (no change)

  1. Encoding (scope):
    instructions: 20.46 M (-0.00%) (change within noise threshold)
    heap_increase: 66 pages (no change)
    stable_memory_increase: 0 pages (no change)

  2. Decoding (scope):
    instructions: 17.84 M (0.00%) (change within noise threshold)
    heap_increase: 33 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: vec_int16
  total:
    instructions: 1.24 B (-0.00%) (change within noise threshold)
    heap_increase: 261 pages (no change)
    stable_memory_increase: 0 pages (no change)

  1. Encoding (scope):
    instructions: 168.58 M (-0.00%) (change within noise threshold)
    heap_increase: 261 pages (no change)
    stable_memory_increase: 0 pages (no change)

  2. Decoding (scope):
    instructions: 1.07 B (0.00%) (change within noise threshold)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: btreemap
  total:
    instructions: 19.73 B (-0.00%) (change within noise threshold)
    heap_increase: 1179 pages (no change)
    stable_memory_increase: 0 pages (no change)

  1. Encoding (scope):
    instructions: 4.02 B (-0.00%) (change within noise threshold)
    heap_increase: 159 pages (no change)
    stable_memory_increase: 0 pages (no change)

  2. Decoding (scope):
    instructions: 15.71 B (0.00%) (change within noise threshold)
    heap_increase: 1020 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: option_list
  total:
    instructions: 46.27 M (regressed by 17.14%)
    heap_increase: 17 pages (regressed by 88.89%)
    stable_memory_increase: 0 pages (no change)

  1. Encoding (scope):
    instructions: 7.15 M (0.10%) (change within noise threshold)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  2. Decoding (scope):
    instructions: 39.12 M (regressed by 20.91%)
    heap_increase: 17 pages (regressed by 88.89%)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: variant_list
  total:
    instructions: 31.67 M (-0.25%) (change within noise threshold)
    heap_increase: 2 pages (no change)
    stable_memory_increase: 0 pages (no change)

  1. Encoding (scope):
    instructions: 7.14 M (-0.00%) (change within noise threshold)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  2. Decoding (scope):
    instructions: 24.53 M (-0.32%) (change within noise threshold)
    heap_increase: 2 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: nns
  total:
    instructions: 34.67 M (0.39%) (change within noise threshold)
    heap_increase: 3 pages (no change)
    stable_memory_increase: 0 pages (no change)

  0. Parsing (scope):
    instructions: 18.79 M (0.00%) (change within noise threshold)
    heap_increase: 2 pages (no change)
    stable_memory_increase: 0 pages (no change)

  1. Encoding (scope):
    instructions: 2.25 M (-0.91%) (change within noise threshold)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  2. Decoding (scope):
    instructions: 12.79 M (1.24%) (change within noise threshold)
    heap_increase: 1 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: nns_list_proposal
  total:
    instructions: 218.74 M (regressed by 12.36%)
    heap_increase: 28 pages (no change)
    stable_memory_increase: 0 pages (no change)

  1. Encoding (scope):
    instructions: 7.04 M (-0.39%) (change within noise threshold)
    heap_increase: 3 pages (no change)
    stable_memory_increase: 0 pages (no change)

  2. Decoding (scope):
    instructions: 211.70 M (regressed by 12.84%)
    heap_increase: 25 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: extra_args
  total:
    instructions: 4.82 M (regressed by 47.97%)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------
Successfully persisted results to canbench_results.yml