Skip to content

Commit

Permalink
ungate native memory operations (#15532)
Browse files Browse the repository at this point in the history
ungate native memory operations
  • Loading branch information
igor-aptos authored Jan 10, 2025
1 parent 366f027 commit 86b696d
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 98 deletions.
2 changes: 2 additions & 0 deletions aptos-move/e2e-benchmark/data/calibration_values.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ VectorTrimAppend { vec_len: 3000, element_len: 1, index: 100, repeats: 1000 } 11
VectorTrimAppend { vec_len: 3000, element_len: 1, index: 2990, repeats: 1000 } 119 0.947 1.093 18431.4
VectorRemoveInsert { vec_len: 3000, element_len: 1, index: 100, repeats: 1000 } 119 0.943 1.107 29034.8
VectorRemoveInsert { vec_len: 3000, element_len: 1, index: 2998, repeats: 1000 } 119 0.954 1.149 20047.3
VectorRangeMove { vec_len: 3000, element_len: 1, index: 1000, move_len: 500, repeats: 1000 } 6 0.925 1.001 32535.4
VectorTrimAppend { vec_len: 100, element_len: 100, index: 0, repeats: 0 } 119 0.909 1.201 293.5
VectorTrimAppend { vec_len: 100, element_len: 100, index: 10, repeats: 1000 } 119 0.951 1.143 12571.2
VectorRangeMove { vec_len: 100, element_len: 100, index: 50, move_len: 10, repeats: 1000 } 6 0.925 1.001 5316.2
60 changes: 35 additions & 25 deletions aptos-move/e2e-benchmark/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ const ABSOLUTE_BUFFER_US: f64 = 2.0;
struct CalibrationInfo {
// count: usize,
expected_time_micros: f64,
min_ratio: f64,
max_ratio: f64,
}

fn get_parsed_calibration_values() -> HashMap<String, CalibrationInfo> {
Expand All @@ -100,6 +102,8 @@ fn get_parsed_calibration_values() -> HashMap<String, CalibrationInfo> {
(parts[0].to_string(), CalibrationInfo {
// count: parts[1].parse().unwrap(),
expected_time_micros: parts[parts.len() - 1].parse().unwrap(),
min_ratio: parts[2].parse().unwrap(),
max_ratio: parts[3].parse().unwrap(),
})
})
.collect()
Expand Down Expand Up @@ -206,13 +210,13 @@ fn main() {
index: 2998,
repeats: 1000,
},
// EntryPoints::VectorRangeMove {
// vec_len: 3000,
// element_len: 1,
// index: 1000,
// move_len: 500,
// repeats: 1000,
// },
EntryPoints::VectorRangeMove {
vec_len: 3000,
element_len: 1,
index: 1000,
move_len: 500,
repeats: 1000,
},
// vectors with large elements
EntryPoints::VectorTrimAppend {
// baseline, only vector creation
Expand All @@ -227,13 +231,13 @@ fn main() {
index: 10,
repeats: 1000,
},
// EntryPoints::VectorRangeMove {
// vec_len: 100,
// element_len: 100,
// index: 50,
// move_len: 10,
// repeats: 1000,
// },
EntryPoints::VectorRangeMove {
vec_len: 100,
element_len: 100,
index: 50,
move_len: 10,
repeats: 1000,
},
];

let mut failures = Vec::new();
Expand All @@ -246,10 +250,10 @@ fn main() {

for (index, entry_point) in entry_points.into_iter().enumerate() {
let entry_point_name = format!("{:?}", entry_point);
let expected_time_micros = calibration_values
let cur_calibration = calibration_values
.get(&entry_point_name)
.expect(&entry_point_name)
.expected_time_micros;
.expect(&entry_point_name);
let expected_time_micros = cur_calibration.expected_time_micros;
let publisher = executor.new_account_at(AccountAddress::random());

let mut package_handler =
Expand Down Expand Up @@ -317,17 +321,23 @@ fn main() {
"test_index": index,
}));

if elapsed_micros > expected_time_micros * (1.0 + ALLOWED_REGRESSION) + ABSOLUTE_BUFFER_US {
let max_regression = f64::max(
expected_time_micros * (1.0 + ALLOWED_REGRESSION) + ABSOLUTE_BUFFER_US,
expected_time_micros * cur_calibration.max_ratio,
);
let max_improvement = f64::min(
expected_time_micros * (1.0 - ALLOWED_IMPROVEMENT) - ABSOLUTE_BUFFER_US,
expected_time_micros * cur_calibration.min_ratio,
);
if elapsed_micros > max_regression {
failures.push(format!(
"Performance regression detected: {:.1}us, expected: {:.1}us, diff: {}%, for {:?}",
elapsed_micros, expected_time_micros, diff, entry_point
"Performance regression detected: {:.1}us, expected: {:.1}us, limit: {:.1}us, diff: {}%, for {:?}",
elapsed_micros, expected_time_micros, max_regression, diff, entry_point
));
} else if elapsed_micros + ABSOLUTE_BUFFER_US
< expected_time_micros * (1.0 - ALLOWED_IMPROVEMENT)
{
} else if elapsed_micros < max_improvement {
failures.push(format!(
"Performance improvement detected: {:.1}us, expected {:.1}us, diff: {}%, for {:?}. You need to adjust expected time!",
elapsed_micros, expected_time_micros, diff, entry_point
"Performance improvement detected: {:.1}us, expected {:.1}us, limit {:.1}us, diff: {}%, for {:?}. You need to adjust expected time!",
elapsed_micros, expected_time_micros, max_improvement, diff, entry_point
));
}
}
Expand Down
4 changes: 2 additions & 2 deletions aptos-move/framework/move-stdlib/doc/bcs.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ On the other hand, if function has returned None for some type,
it might change in the future to return Some() instead, if size becomes "known".


<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="bcs.md#0x1_bcs_constant_serialized_size">constant_serialized_size</a>&lt;MoveValue&gt;(): <a href="option.md#0x1_option_Option">option::Option</a>&lt;u64&gt;
<pre><code><b>public</b> <b>fun</b> <a href="bcs.md#0x1_bcs_constant_serialized_size">constant_serialized_size</a>&lt;MoveValue&gt;(): <a href="option.md#0x1_option_Option">option::Option</a>&lt;u64&gt;
</code></pre>


Expand All @@ -94,7 +94,7 @@ it might change in the future to return Some() instead, if size becomes "known".
<summary>Implementation</summary>


<pre><code><b>native</b> <b>public</b>(<b>friend</b>) <b>fun</b> <a href="bcs.md#0x1_bcs_constant_serialized_size">constant_serialized_size</a>&lt;MoveValue&gt;(): Option&lt;u64&gt;;
<pre><code><b>native</b> <b>public</b> <b>fun</b> <a href="bcs.md#0x1_bcs_constant_serialized_size">constant_serialized_size</a>&lt;MoveValue&gt;(): Option&lt;u64&gt;;
</code></pre>


Expand Down
4 changes: 2 additions & 2 deletions aptos-move/framework/move-stdlib/doc/vector.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ Move prevents from having two mutable references to the same value, so <code>fro
vectors are always distinct.


<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="vector.md#0x1_vector_move_range">move_range</a>&lt;T&gt;(from: &<b>mut</b> <a href="vector.md#0x1_vector">vector</a>&lt;T&gt;, removal_position: u64, length: u64, <b>to</b>: &<b>mut</b> <a href="vector.md#0x1_vector">vector</a>&lt;T&gt;, insert_position: u64)
<pre><code><b>public</b> <b>fun</b> <a href="vector.md#0x1_vector_move_range">move_range</a>&lt;T&gt;(from: &<b>mut</b> <a href="vector.md#0x1_vector">vector</a>&lt;T&gt;, removal_position: u64, length: u64, <b>to</b>: &<b>mut</b> <a href="vector.md#0x1_vector">vector</a>&lt;T&gt;, insert_position: u64)
</code></pre>


Expand All @@ -381,7 +381,7 @@ vectors are always distinct.
<summary>Implementation</summary>


<pre><code><b>native</b> <b>public</b>(<b>friend</b>) <b>fun</b> <a href="vector.md#0x1_vector_move_range">move_range</a>&lt;T&gt;(
<pre><code><b>native</b> <b>public</b> <b>fun</b> <a href="vector.md#0x1_vector_move_range">move_range</a>&lt;T&gt;(
from: &<b>mut</b> <a href="vector.md#0x1_vector">vector</a>&lt;T&gt;,
removal_position: u64,
length: u64,
Expand Down
7 changes: 1 addition & 6 deletions aptos-move/framework/move-stdlib/sources/bcs.move
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ module std::bcs {
/// Aborts with `0x1c5` error code if there is a failure when calculating serialized size.
native public fun serialized_size<MoveValue>(v: &MoveValue): u64;

// TODO - function `constant_serialized_size1 is `public(friend)` here for one release,
// and to be changed to `public` one release later.
#[test_only]
friend std::bcs_tests;

/// If the type has known constant (always the same, independent of instance) serialized size
/// in BCS (Binary Canonical Serialization) format, returns it, otherwise returns None.
/// Aborts with `0x1c5` error code if there is a failure when calculating serialized size.
Expand All @@ -28,7 +23,7 @@ module std::bcs {
/// If this function returned Some() for some type before - it is guaranteed to continue returning Some().
/// On the other hand, if function has returned None for some type,
/// it might change in the future to return Some() instead, if size becomes "known".
native public(friend) fun constant_serialized_size<MoveValue>(): Option<u64>;
native public fun constant_serialized_size<MoveValue>(): Option<u64>;

// ==============================
// Module Specification
Expand Down
7 changes: 1 addition & 6 deletions aptos-move/framework/move-stdlib/sources/vector.move
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ module std::vector {
/// Aborts if `i` or `j` is out of bounds.
native public fun swap<Element>(self: &mut vector<Element>, i: u64, j: u64);

// TODO - function `move_range` here is `public(friend)` for one release,
// and to be changed to `public` one release later.
#[test_only]
friend std::vector_tests;

/// Moves range of elements `[removal_position, removal_position + length)` from vector `from`,
/// to vector `to`, inserting them starting at the `insert_position`.
/// In the `from` vector, elements after the selected range are moved left to fill the hole
Expand All @@ -82,7 +77,7 @@ module std::vector {
/// elements is kept).
/// Move prevents from having two mutable references to the same value, so `from` and `to`
/// vectors are always distinct.
native public(friend) fun move_range<T>(
native public fun move_range<T>(
from: &mut vector<T>,
removal_position: u64,
length: u64,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ pub fn create_prebuilt_packages_rs_file(
writeln!(
string_buffer,
"
use aptos_transaction_generator_lib::entry_point_trait::PreBuiltPackages;
use once_cell::sync::Lazy;
use std::collections::HashMap;
use aptos_transaction_generator_lib::entry_point_trait::PreBuiltPackages;",
use std::collections::HashMap;",
)
.expect("Use directive failed");
writeln!(string_buffer).expect("Empty line failed");
Expand Down
2 changes: 1 addition & 1 deletion crates/transaction-workloads-lib/src/move_workloads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ impl EntryPointTrait for EntryPoints {
repeats,
} => get_payload(
module_id,
ident_str!("test_middle_range_move").to_owned(),
ident_str!("test_middle_move_range").to_owned(),
vec![
bcs::to_bytes(vec_len).unwrap(),
bcs::to_bytes(element_len).unwrap(),
Expand Down
99 changes: 54 additions & 45 deletions crates/transaction-workloads-lib/src/raw_module_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,11 @@ pub static MODULES_SIMPLE: Lazy<Vec<Vec<u8>>> = Lazy::new(|| { vec![
pub static PACKAGE_FRAMEWORK_USECASES_METADATA: Lazy<Vec<u8>> = Lazy::new(|| {
vec![
17, 70, 114, 97, 109, 101, 119, 111, 114, 107, 85, 115, 101, 99, 97, 115, 101, 115,
1, 0, 0, 0, 0, 0, 0, 0, 0, 64, 67, 51, 69, 57, 51, 69, 69, 54,
70, 68, 66, 54, 67, 65, 65, 55, 52, 70, 50, 48, 50, 55, 70, 56, 68, 54,
65, 51, 55, 70, 69, 70, 68, 50, 65, 69, 69, 54, 56, 70, 56, 65, 57, 57,
70, 54, 55, 70, 65, 48, 57, 52, 65, 48, 68, 50, 67, 56, 57, 70, 54, 56,
48, 55, 215, 1, 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 165, 144, 187, 142,
1, 0, 0, 0, 0, 0, 0, 0, 0, 64, 67, 52, 70, 68, 56, 67, 50, 49,
56, 51, 69, 66, 52, 70, 55, 48, 70, 70, 65, 52, 66, 69, 56, 65, 48, 67,
57, 54, 68, 53, 50, 67, 70, 69, 52, 53, 68, 55, 48, 49, 68, 49, 52, 57,
55, 56, 57, 50, 51, 53, 55, 69, 55, 70, 55, 57, 50, 68, 70, 55, 68, 56,
66, 50, 215, 1, 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 165, 144, 187, 142,
194, 64, 12, 69, 251, 249, 10, 107, 182, 38, 236, 15, 108, 193, 238, 138, 150, 6,
170, 8, 33, 51, 49, 33, 100, 176, 163, 241, 240, 144, 16, 255, 78, 44, 30, 130,
22, 100, 23, 215, 246, 189, 167, 112, 217, 97, 104, 177, 166, 185, 99, 220, 18, 252,
Expand Down Expand Up @@ -874,47 +874,56 @@ pub static MODULE_FRAMEWORK_USECASES_TOKEN_V1: Lazy<Vec<u8>> = Lazy::new(|| {
#[rustfmt::skip]
pub static MODULE_FRAMEWORK_USECASES_VECTOR_EXAMPLE: Lazy<Vec<u8>> = Lazy::new(|| {
vec![
161, 28, 235, 11, 7, 0, 0, 10, 8, 1, 0, 4, 3, 4, 46, 4, 50, 8,
5, 58, 77, 7, 135, 1, 97, 8, 232, 1, 64, 16, 168, 2, 31, 12, 199, 2,
213, 2, 0, 0, 1, 3, 0, 1, 0, 1, 0, 1, 0, 2, 5, 6, 0, 1,
1, 4, 7, 8, 1, 0, 1, 1, 5, 9, 6, 1, 0, 1, 0, 6, 5, 6,
0, 1, 1, 7, 7, 11, 1, 0, 1, 1, 8, 12, 6, 1, 0, 1, 2, 3,
3, 3, 5, 3, 6, 3, 2, 3, 3, 1, 10, 10, 3, 1, 3, 1, 10, 3,
9, 10, 3, 3, 1, 10, 10, 3, 3, 1, 3, 10, 3, 7, 3, 4, 3, 3,
3, 3, 0, 2, 7, 10, 9, 0, 3, 1, 9, 0, 3, 7, 10, 9, 0, 3,
9, 0, 3, 10, 10, 3, 1, 10, 3, 1, 10, 9, 0, 2, 7, 10, 9, 0,
10, 9, 0, 3, 10, 10, 3, 1, 10, 10, 3, 14, 118, 101, 99, 116, 111, 114,
95, 101, 120, 97, 109, 112, 108, 101, 12, 103, 101, 110, 101, 114, 97, 116, 101, 95,
118, 101, 99, 18, 116, 101, 115, 116, 95, 114, 101, 109, 111, 118, 101, 95, 105, 110,
115, 101, 114, 116, 6, 118, 101, 99, 116, 111, 114, 6, 114, 101, 109, 111, 118, 101,
6, 105, 110, 115, 101, 114, 116, 16, 116, 101, 115, 116, 95, 116, 114, 105, 109, 95,
97, 112, 112, 101, 110, 100, 4, 116, 114, 105, 109, 6, 97, 112, 112, 101, 110, 100,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 171, 205, 0, 0, 0, 0,
161, 28, 235, 11, 7, 0, 0, 10, 8, 1, 0, 4, 3, 4, 59, 4, 63, 10,
5, 73, 103, 7, 176, 1, 131, 1, 8, 179, 2, 64, 16, 243, 2, 31, 12, 146,
3, 184, 3, 0, 0, 1, 3, 0, 1, 0, 1, 0, 1, 0, 2, 5, 6, 0,
1, 1, 4, 7, 6, 1, 0, 1, 0, 5, 9, 6, 0, 1, 1, 6, 10, 11,
1, 0, 1, 1, 7, 12, 6, 1, 0, 1, 0, 8, 9, 6, 0, 1, 1, 9,
10, 14, 1, 0, 1, 1, 10, 15, 6, 1, 0, 1, 2, 3, 4, 3, 5, 3,
7, 3, 8, 3, 2, 3, 3, 1, 10, 10, 3, 1, 3, 1, 10, 3, 9, 10,
3, 3, 1, 10, 10, 3, 3, 1, 3, 10, 3, 7, 3, 5, 3, 3, 3, 3,
3, 0, 5, 7, 10, 9, 0, 3, 3, 7, 10, 9, 0, 3, 3, 10, 10, 3,
10, 10, 3, 1, 4, 3, 3, 3, 3, 2, 7, 10, 9, 0, 3, 1, 9, 0,
3, 7, 10, 9, 0, 3, 9, 0, 3, 10, 10, 3, 1, 10, 3, 1, 10, 9,
0, 2, 7, 10, 9, 0, 10, 9, 0, 3, 10, 10, 3, 1, 10, 10, 3, 14,
118, 101, 99, 116, 111, 114, 95, 101, 120, 97, 109, 112, 108, 101, 12, 103, 101, 110,
101, 114, 97, 116, 101, 95, 118, 101, 99, 22, 116, 101, 115, 116, 95, 109, 105, 100,
100, 108, 101, 95, 109, 111, 118, 101, 95, 114, 97, 110, 103, 101, 6, 118, 101, 99,
116, 111, 114, 10, 109, 111, 118, 101, 95, 114, 97, 110, 103, 101, 18, 116, 101, 115,
116, 95, 114, 101, 109, 111, 118, 101, 95, 105, 110, 115, 101, 114, 116, 6, 114, 101,
109, 111, 118, 101, 6, 105, 110, 115, 101, 114, 116, 16, 116, 101, 115, 116, 95, 116,
114, 105, 109, 95, 97, 112, 112, 101, 110, 100, 4, 116, 114, 105, 109, 6, 97, 112,
112, 101, 110, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 171, 205,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 20, 99, 111, 109, 112, 105, 108, 97,
116, 105, 111, 110, 95, 109, 101, 116, 97, 100, 97, 116, 97, 9, 0, 3, 50, 46,
48, 3, 50, 46, 49, 0, 0, 0, 0, 4, 65, 64, 2, 0, 0, 0, 0, 0,
0, 0, 0, 12, 2, 6, 0, 0, 0, 0, 0, 0, 0, 0, 12, 3, 9, 12,
4, 5, 8, 5, 23, 10, 4, 4, 62, 11, 3, 6, 1, 0, 0, 0, 0, 0,
0, 0, 22, 12, 3, 10, 3, 10, 1, 35, 3, 19, 5, 23, 13, 2, 10, 3,
68, 2, 5, 6, 64, 3, 0, 0, 0, 0, 0, 0, 0, 0, 12, 5, 6, 0,
0, 0, 0, 0, 0, 0, 0, 12, 6, 9, 12, 7, 11, 0, 12, 8, 5, 33,
5, 57, 10, 7, 4, 59, 11, 6, 6, 1, 0, 0, 0, 0, 0, 0, 0, 22,
12, 6, 10, 6, 10, 8, 35, 3, 44, 5, 57, 10, 2, 12, 9, 13, 9, 6,
0, 0, 0, 0, 0, 0, 0, 0, 67, 2, 12, 10, 10, 6, 11, 10, 21, 13,
5, 11, 9, 68, 3, 5, 31, 11, 5, 2, 8, 12, 7, 5, 39, 8, 12, 4,
5, 14, 1, 1, 4, 0, 10, 34, 11, 0, 11, 1, 17, 0, 12, 4, 6, 0,
0, 0, 0, 0, 0, 0, 0, 12, 0, 9, 12, 5, 5, 10, 5, 30, 10, 5,
4, 31, 11, 0, 6, 1, 0, 0, 0, 0, 0, 0, 0, 22, 12, 0, 10, 0,
10, 3, 35, 3, 21, 5, 30, 13, 4, 10, 2, 56, 0, 12, 6, 13, 4, 10,
2, 11, 6, 56, 1, 5, 8, 2, 8, 12, 5, 5, 16, 4, 1, 4, 0, 13,
33, 11, 0, 11, 1, 17, 0, 12, 4, 6, 0, 0, 0, 0, 0, 0, 0, 0,
12, 0, 9, 12, 5, 5, 10, 5, 29, 10, 5, 4, 30, 11, 0, 6, 1, 0,
0, 0, 0, 0, 0, 0, 22, 12, 0, 10, 0, 10, 3, 35, 3, 21, 5, 29,
13, 4, 10, 2, 56, 2, 12, 6, 13, 4, 11, 6, 56, 3, 5, 8, 2, 8,
12, 5, 5, 16, 0,
]
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 20, 99, 111, 109,
112, 105, 108, 97, 116, 105, 111, 110, 95, 109, 101, 116, 97, 100, 97, 116, 97, 9,
0, 3, 50, 46, 48, 3, 50, 46, 49, 0, 0, 0, 0, 4, 65, 64, 2, 0,
0, 0, 0, 0, 0, 0, 0, 12, 2, 6, 0, 0, 0, 0, 0, 0, 0, 0,
12, 3, 9, 12, 4, 5, 8, 5, 23, 10, 4, 4, 62, 11, 3, 6, 1, 0,
0, 0, 0, 0, 0, 0, 22, 12, 3, 10, 3, 10, 1, 35, 3, 19, 5, 23,
13, 2, 10, 3, 68, 2, 5, 6, 64, 3, 0, 0, 0, 0, 0, 0, 0, 0,
12, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 12, 6, 9, 12, 7, 11, 0,
12, 8, 5, 33, 5, 57, 10, 7, 4, 59, 11, 6, 6, 1, 0, 0, 0, 0,
0, 0, 0, 22, 12, 6, 10, 6, 10, 8, 35, 3, 44, 5, 57, 10, 2, 12,
9, 13, 9, 6, 0, 0, 0, 0, 0, 0, 0, 0, 67, 2, 12, 10, 10, 6,
11, 10, 21, 13, 5, 11, 9, 68, 3, 5, 31, 11, 5, 2, 8, 12, 7, 5,
39, 8, 12, 4, 5, 14, 1, 1, 4, 0, 8, 42, 10, 0, 10, 1, 17, 0,
12, 5, 11, 0, 11, 1, 17, 0, 12, 6, 6, 0, 0, 0, 0, 0, 0, 0,
0, 12, 0, 9, 12, 7, 5, 14, 5, 38, 10, 7, 4, 39, 11, 0, 6, 1,
0, 0, 0, 0, 0, 0, 0, 22, 12, 0, 10, 0, 10, 4, 35, 3, 25, 5,
38, 13, 5, 10, 2, 10, 3, 13, 6, 10, 2, 56, 0, 13, 6, 10, 2, 10,
3, 13, 5, 10, 2, 56, 0, 5, 12, 2, 8, 12, 7, 5, 20, 3, 1, 4,
0, 13, 34, 11, 0, 11, 1, 17, 0, 12, 4, 6, 0, 0, 0, 0, 0, 0,
0, 0, 12, 0, 9, 12, 5, 5, 10, 5, 30, 10, 5, 4, 31, 11, 0, 6,
1, 0, 0, 0, 0, 0, 0, 0, 22, 12, 0, 10, 0, 10, 3, 35, 3, 21,
5, 30, 13, 4, 10, 2, 56, 1, 12, 6, 13, 4, 10, 2, 11, 6, 56, 2,
5, 8, 2, 8, 12, 5, 5, 16, 6, 1, 4, 0, 16, 33, 11, 0, 11, 1,
17, 0, 12, 4, 6, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 9, 12, 5,
5, 10, 5, 29, 10, 5, 4, 30, 11, 0, 6, 1, 0, 0, 0, 0, 0, 0,
0, 22, 12, 0, 10, 0, 10, 3, 35, 3, 21, 5, 29, 13, 4, 10, 2, 56,
3, 12, 6, 13, 4, 11, 6, 56, 4, 5, 8, 2, 8, 12, 5, 5, 16, 0,
]
});

#[rustfmt::skip]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ module 0xABCD::vector_example {
};
}

// public entry fun test_middle_range_move(vec_len: u64, element_len: u64, index: u64, move_len: u64, repeats: u64) {
// let vec1 = generate_vec(vec_len, element_len);
// let vec2 = generate_vec(vec_len, element_len);

// for (i in 0..repeats) {
// vector::move_range(&mut vec1, index, move_len, &mut vec2, index);
// vector::move_range(&mut vec2, index, move_len, &mut vec1, index);
// };
// }
public entry fun test_middle_move_range(vec_len: u64, element_len: u64, index: u64, move_len: u64, repeats: u64) {
let vec1 = generate_vec(vec_len, element_len);
let vec2 = generate_vec(vec_len, element_len);

for (i in 0..repeats) {
vector::move_range(&mut vec1, index, move_len, &mut vec2, index);
vector::move_range(&mut vec2, index, move_len, &mut vec1, index);
};
}
}

0 comments on commit 86b696d

Please sign in to comment.