Skip to content

feat: add support for doc comments#631

Closed
ilbertt wants to merge 16 commits intoluca/idl-types-in-parserfrom
luca/comments
Closed

feat: add support for doc comments#631
ilbertt wants to merge 16 commits intoluca/idl-types-in-parserfrom
luca/comments

Conversation

@ilbertt
Copy link
Copy Markdown
Contributor

@ilbertt ilbertt commented Jun 25, 2025

Overview
Inspired from #621.

Adds support for triple slash (///) doc comments in Candid. These comments are parsed and passed to the bindings generators.
See the rust/candid_parser/tests/assets/example.did test case and its relative generated bindings rust/candid_parser/tests/assets/ok/example.*.

Closes #619.
Closes #620.
Closes #621.

Requirements
Blocked by #625.

Considerations

  • we have added support for triple slash comments to avoid breaking the existing Candid declaration files out there.
  • we'll add support for deriving comments from Rust methods and types in feat: derive doc comments from Rust #633

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 25, 2025

Name Max Mem (Kb) Encode Decode
blob 4_224 4_206_499 ($\textcolor{red}{0.00\%}$) 2_121_046
btreemap 75_456 4_261_360_574 ($\textcolor{red}{0.00\%}$) 15_191_359_407
nns 256 1_971_454 ($\textcolor{red}{0.44\%}$) 5_452_524 ($\textcolor{red}{0.09\%}$)
nns_list_proposal 1_088 6_804_338 ($\textcolor{red}{0.16\%}$) 66_773_097 ($\textcolor{green}{-0.00\%}$)
option_list 128 7_480_694 ($\textcolor{red}{0.08\%}$) 25_414_428
text 6_336 4_203_377 7_877_221
variant_list 128 7_536_993 ($\textcolor{red}{0.09\%}$) 23_996_664 ($\textcolor{red}{0.33\%}$)
vec_int16 16_704 123_692_826 ($\textcolor{red}{0.00\%}$) 1_019_238_900
  • Parser cost: 17_237_865 ($\textcolor{red}{8.99\%}$)
  • Extra args: 3_147_769
Click to see raw report
---------------------------------------------------

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

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

  2. Decoding (scope):
    calls: 1 (no change)
    instructions: 2.12 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: text
  total:
    instructions: 12.08 M (no change)
    heap_increase: 99 pages (no change)
    stable_memory_increase: 0 pages (no change)

  1. Encoding (scope):
    calls: 1 (no change)
    instructions: 4.20 M (no change)
    heap_increase: 66 pages (no change)
    stable_memory_increase: 0 pages (no change)

  2. Decoding (scope):
    calls: 1 (no change)
    instructions: 7.88 M (no change)
    heap_increase: 33 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

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

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

  2. Decoding (scope):
    calls: 1 (no change)
    instructions: 1.02 B (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

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

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

  2. Decoding (scope):
    calls: 1 (no change)
    instructions: 15.19 B (no change)
    heap_increase: 1020 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

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

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

  2. Decoding (scope):
    calls: 1 (no change)
    instructions: 25.41 M (no change)
    heap_increase: 2 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

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

  1. Encoding (scope):
    calls: 1 (no change)
    instructions: 7.54 M (0.09%) (change within noise threshold)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

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

Benchmark: nns
  total:
    instructions: 25.50 M (regressed by 5.96%)
    heap_increase: 4 pages (no change)
    stable_memory_increase: 0 pages (no change)

  0. Parsing (scope):
    calls: 1 (no change)
    instructions: 17.24 M (regressed by 8.99%)
    heap_increase: 4 pages (no change)
    stable_memory_increase: 0 pages (no change)

  1. Encoding (scope):
    calls: 1 (no change)
    instructions: 1.97 M (0.44%) (change within noise threshold)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

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

Benchmark: nns_list_proposal
  total:
    instructions: 73.58 M (0.01%) (change within noise threshold)
    heap_increase: 17 pages (no change)
    stable_memory_increase: 0 pages (no change)

  1. Encoding (scope):
    calls: 1 (no change)
    instructions: 6.80 M (0.16%) (change within noise threshold)
    heap_increase: 3 pages (no change)
    stable_memory_increase: 0 pages (no change)

  2. Decoding (scope):
    calls: 1 (no change)
    instructions: 66.77 M (-0.00%) (change within noise threshold)
    heap_increase: 14 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: extra_args
  total:
    instructions: 3.15 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Summary:
  instructions:
    status:   Regressions detected 🔴
    counts:   [total 9 | regressed 1 | improved 0 | new 0 | unchanged 8]
    change:   [max +1.44M | p75 +10.47K | median +160 | p25 +82 | min 0]
    change %: [max +5.96% | p75 +0.02% | median 0.00% | p25 0.00% | min 0.00%]

  heap_increase:
    status:   No significant changes 👍
    counts:   [total 9 | regressed 0 | improved 0 | new 0 | unchanged 9]
    change:   [max 0 | p75 0 | median 0 | p25 0 | min 0]
    change %: [max 0.00% | p75 0.00% | median 0.00% | p25 0.00% | min 0.00%]

  stable_memory_increase:
    status:   No significant changes 👍
    counts:   [total 9 | regressed 0 | improved 0 | new 0 | unchanged 9]
    change:   [max 0 | p75 0 | median 0 | p25 0 | min 0]
    change %: [max 0.00% | p75 0.00% | median 0.00% | p25 0.00% | min 0.00%]

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

Only significant changes:
| status | name            | calls |    ins |  ins Δ% | HI |  HI Δ% | SMI |  SMI Δ% |
|--------|-----------------|-------|--------|---------|----|--------|-----|---------|
|   +    | nns::0. Parsing |     1 | 17.24M |  +8.99% |  4 |  0.00% |   0 |   0.00% |
|   +    | nns             |       | 25.50M |  +5.96% |  4 |  0.00% |   0 |   0.00% |

ins = instructions, HI = heap_increase, SMI = stable_memory_increase, Δ% = percent change

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

@ilbertt ilbertt marked this pull request as ready for review June 27, 2025 17:50
@ilbertt ilbertt requested a review from a team as a code owner June 27, 2025 17:50
Copy link
Copy Markdown
Contributor Author

@ilbertt ilbertt Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll add support for deriving comments in #633

@ilbertt ilbertt marked this pull request as draft July 1, 2025 13:48
@ilbertt ilbertt closed this in #635 Jul 2, 2025
@ilbertt ilbertt deleted the luca/comments branch July 10, 2025 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants