Skip to content

Conversation

@vaivaswatha
Copy link
Contributor

@vaivaswatha vaivaswatha commented Nov 19, 2025

Improvement chart: #7499 (comment)

@vaivaswatha vaivaswatha self-assigned this Nov 19, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 19, 2025

CodSpeed Performance Report

Merging #7499 will not alter performance

Comparing vaivaswatha/alloc_intrinsic (a7210d6) with master (936e752)

Summary

✅ 25 untouched

@vaivaswatha vaivaswatha marked this pull request as ready for review November 24, 2025 09:47
@vaivaswatha vaivaswatha requested review from a team as code owners November 24, 2025 09:47
zees-dev
zees-dev previously approved these changes Nov 25, 2025
Copy link
Member

@ironcev ironcev left a comment

Choose a reason for hiding this comment

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

Can we get performance comparison stats in the PR description and diffs in a comment?

@vaivaswatha
Copy link
Contributor Author

e2e-gas-usages

Improvements Regressions
Count 3 4
Average 16.09% -0.92%
Median 11.61% -1.19%
Max 35.63% -1.28%
Min 1.03% -0.01%
Individual tests
Test Before After Percentage
should_fail/vec_set_index_out_of_bounds (test.toml) 179 181 -1.12%
should_fail/vec_swap_param1_out_of_bounds (test.toml) 234 237 -1.28%
should_fail/vec_swap_param2_out_of_bounds (test.toml) 238 241 -1.26%
should_pass/language/generic_type_inference (test.toml) 1335 1180 11.61%
should_pass/stdlib/alloc_test (test.toml) 174 112 35.63%
should_pass/stdlib/vec (test.toml) 65162 65169 -0.01%
should_pass/stdlib/vec_swap (test.toml) 14771 14619 1.03%

e2e-bytecode-sizes

Improvements Regressions
Count 1 6
Average 23.53% -2.07%
Median 23.53% -1.39%
Max 23.53% -6.91%
Min 23.53% -0.40%
Individual tests
Test Before After Percentage
should_fail/vec_set_index_out_of_bounds (test.toml) 520 528 -1.54%
should_fail/vec_swap_param1_out_of_bounds (test.toml) 576 584 -1.39%
should_fail/vec_swap_param2_out_of_bounds (test.toml) 576 584 -1.39%
should_pass/language/generic_type_inference (test.toml) 2432 2600 -6.91%
should_pass/stdlib/alloc_test (test.toml) 544 416 23.53%
should_pass/stdlib/vec (test.toml) 80816 81136 -0.40%
should_pass/stdlib/vec_swap (test.toml) 18976 19128 -0.80%

in-language-gas-usages

Improvements Regressions
Count 42 6
Average 10.42% -0.27%
Median 9.13% -0.23%
Max 60.26% -0.42%
Min 0.01% -0.16%
Individual tests
Test Before After Percentage
alloc_inline_tests::alloc_realloc 27630 27183 1.62%
alloc_inline_tests::revert_alloc_realloc_when_realloc_unallocated_memory 78 31 60.26%
bytes_inline_tests::bytes_from_vec_u8 1421 1427 -0.42%
bytes_inline_tests::bytes_into_vec_u8 1278 1280 -0.16%
bytes_inline_tests::bytes_vec_u8_from 1260 1262 -0.16%
bytes_inline_tests::bytes_vec_u8_into 1421 1427 -0.42%
storage_vec_iter_tests::empty_vec_next_returns_none 50644 50738 -0.19%
storage_vec_iter_tests::storage_vec_field_for_loop_iteration 1573470 1573407 0.00%
storage_vec_iter_tests::storage_vec_field_nested_for_loop_iteration 11559644 11559581 0.00%
storage_vec_iter_tests::vec_with_elements_for_loop_iteration 24011576 24009215 0.01%
storage_vec_iter_tests::vec_with_elements_next_returns_element 24011606 24009171 0.01%
vec_inline_tests::revert_vec_insert_out_of_bounds 757 646 14.66%
vec_inline_tests::revert_vec_remove_out_of_bounds 743 632 14.94%
vec_inline_tests::revert_vec_set_out_of_bounds 735 624 15.10%
vec_inline_tests::revert_vec_swap_element_1_out_of_bounds 735 624 15.10%
vec_inline_tests::revert_vec_swap_element_2_out_of_bounds 743 632 14.94%
vec_inline_tests::vec_as_raw_slice 794 683 13.98%
vec_inline_tests::vec_buffer_ownership 2200 2206 -0.27%
vec_inline_tests::vec_capacity 966 818 15.32%
vec_inline_tests::vec_clear 719 608 15.44%
vec_inline_tests::vec_clear_twice 796 685 13.94%
vec_inline_tests::vec_clone 1647 1536 6.74%
vec_inline_tests::vec_encode_and_decode 2315 2204 4.79%
vec_inline_tests::vec_get 1695 1584 6.55%
vec_inline_tests::vec_insert 1460 1349 7.60%
vec_inline_tests::vec_insert_back 1398 1287 7.94%
vec_inline_tests::vec_insert_before_back 1423 1312 7.80%
vec_inline_tests::vec_insert_front 1483 1370 7.62%
vec_inline_tests::vec_insert_twice 2474 2326 5.98%
vec_inline_tests::vec_is_empty 804 693 13.81%
vec_inline_tests::vec_iter 2117 1969 6.99%
vec_inline_tests::vec_last 1838 1690 8.05%
vec_inline_tests::vec_len 1143 995 12.95%
vec_inline_tests::vec_pop 2982 2797 6.20%
vec_inline_tests::vec_ptr 814 703 13.64%
vec_inline_tests::vec_push 1484 1299 12.47%
vec_inline_tests::vec_remove 1505 1394 7.38%
vec_inline_tests::vec_remove_all 1177 1066 9.43%
vec_inline_tests::vec_remove_end 1222 1111 9.08%
vec_inline_tests::vec_remove_front 1272 1161 8.73%
vec_inline_tests::vec_resize 4937 4748 3.83%
vec_inline_tests::vec_set 1202 1091 9.23%
vec_inline_tests::vec_set_back 1206 1095 9.20%
vec_inline_tests::vec_set_front 1202 1091 9.23%
vec_inline_tests::vec_set_twice 1675 1564 6.63%
vec_inline_tests::vec_swap 1456 1345 7.62%
vec_inline_tests::vec_swap_end 1209 1098 9.18%
vec_inline_tests::vec_swap_front 1207 1096 9.20%
vec_inline_tests::vec_swap_front_with_end 1209 1098 9.18%
vec_inline_tests::vec_swap_twice 2116 2005 5.25%

@ironcev ironcev requested a review from zees-dev November 26, 2025 08:54
@vaivaswatha vaivaswatha enabled auto-merge (squash) November 26, 2025 08:56
@cursor
Copy link

cursor bot commented Nov 26, 2025

PR Summary

Introduce __alloc<T>(count: u64) -> raw_ptr intrinsic, integrate across AST/IR/type-check/verification/printing/parsing/Fuel codegen, and switch std::alloc to use it (docs/tests updated).

  • Compiler/AST/Semantics:
    • Add Intrinsic::Alloc with parsing ("__alloc"), display ("alloc"), and type-checking (type_arg<T>, count: u64 -> returns raw_ptr).
    • Const-eval excludes Alloc.
  • IR:
    • Introduce InstOp::Alloc { ty, count }, result type ptr; operands/walkers/CSE/dedup/inline/memory utils updated.
    • Parser/printer support alloc <ty> x <count>; verifier enforces count is u64.
    • Block API: append(...).alloc(ty, count).
  • Codegen:
    • Fuel: implement compile_alloc (compute bytes = size_of<T> × count, ALOC, return heap pointer).
    • EVM: add compile_alloc stub (todo).
  • Stdlib:
    • std::alloc::alloc<T> now calls __alloc::<T>(count) (removes inline asm).
  • Docs:
    • Document __alloc<T>(count: u64) -> raw_ptr intrinsic in compiler_intrinsics.md.
  • Tests/Snapshots:
    • Update IR/gas/size snapshots; minor contract ID update.

Written by Cursor Bugbot for commit a7210d6. This will update automatically on new commits. Configure here.

@vaivaswatha vaivaswatha merged commit ec51769 into master Nov 26, 2025
52 checks passed
@vaivaswatha vaivaswatha deleted the vaivaswatha/alloc_intrinsic branch November 26, 2025 10:18
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.

5 participants