dfinity / candid

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

feat: add infinite type test #543

Closed mraszyk closed 6 months ago

mraszyk commented 6 months ago

This PR adds an infinite type test corresponding to this didc invokation:

$ didc decode 4449444c016c020778080001002a00000000000000
Error: Fail to decode argument 0 from table0 to unknown

Caused by:
    0: input: 4449444c016c02077808000100_2a00000000000000
       table: type table0 = empty
       wire_type: empty, expect_type: empty
    1: Subtyping error: Cannot decode empty type
github-actions[bot] commented 6 months ago
Name Max Mem (Kb) Encode Decode
blob 4_224 20_464_176 ($\textcolor{green}{-0.00\%}$) 12_084_214 ($\textcolor{red}{0.00\%}$)
btreemap 75_456 4_814_047_219 ($\textcolor{green}{-0.00\%}$) 15_380_666_953 ($\textcolor{red}{0.00\%}$)
nns 192 2_274_916 ($\textcolor{green}{-0.08\%}$) 14_317_956 ($\textcolor{green}{-0.16\%}$)
nns_list_proposal 1_728 19_125_888 ($\textcolor{green}{-0.80\%}$) 182_059_941 ($\textcolor{green}{-0.03\%}$)
option_list 576 7_310_859 ($\textcolor{green}{-0.00\%}$) 33_834_131 ($\textcolor{green}{-0.05\%}$)
text 6_336 28_847_566 ($\textcolor{green}{-0.00\%}$) 17_839_905 ($\textcolor{red}{0.00\%}$)
variant_list 128 7_518_554 ($\textcolor{green}{-0.00\%}$) 25_490_973 ($\textcolor{red}{0.02\%}$)
vec_int16 16_704 168_590_852 ($\textcolor{green}{-0.00\%}$) 1_031_830_179 ($\textcolor{red}{0.00\%}$)

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

Benchmark: blob
  total:
    instructions: 32.55 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: 46.69 M (-0.00%) (change within noise threshold)
    heap_increase: 99 pages (no change)
    stable_memory_increase: 0 pages (no change)

  1. Encoding (scope):
    instructions: 28.85 M (-0.00%) (change within noise threshold)
    heap_increase: 99 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: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: vec_int16
  total:
    instructions: 1.20 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.59 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.03 B (0.00%) (change within noise threshold)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: btreemap
  total:
    instructions: 20.19 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.81 B (-0.00%) (change within noise threshold)
    heap_increase: 257 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

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

Benchmark: option_list
  total:
    instructions: 41.15 M (-0.04%) (change within noise threshold)
    heap_increase: 9 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

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

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

Benchmark: variant_list
  total:
    instructions: 33.01 M (0.02%) (change within noise threshold)
    heap_increase: 2 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

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

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

Benchmark: nns
  total:
    instructions: 35.69 M (-0.07%) (change within noise threshold)
    heap_increase: 3 pages (no change)
    stable_memory_increase: 0 pages (no change)

  0. Parsing (scope):
    instructions: 18.35 M (no change)
    heap_increase: 3 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

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

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

Benchmark: nns_list_proposal
  total:
    instructions: 201.19 M (-0.10%) (change within noise threshold)
    heap_increase: 27 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

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

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

Benchmark: extra_args
  total:
    instructions: 3.35 M (-0.39%) (change within noise threshold)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

mraszyk commented 6 months ago

An analogous test already exists: https://github.com/dfinity/candid/blob/ae4d0f794a808b88f8b83da7eb96ca87b3d751d4/test/construct.test.did#L93