Skip to content

Commit fb57ca8

Browse files
committed
refactor!: Remove DeprecatedSnippet impl
Implement `BasicSnippet` for `MemCpy` directly instead. changelog: ignore
1 parent f7d708c commit fb57ca8

File tree

6 files changed

+132
-386
lines changed

6 files changed

+132
-386
lines changed

tasm-lib/benchmarks/tasmlib_list_higher_order_u32_filter_test_hash_xfield_element_lsb.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
{
33
"name": "tasmlib_list_higher_order_u32_filter_test_hash_xfield_element_lsb",
44
"benchmark_result": {
5-
"clock_cycle_count": 923,
6-
"hash_table_height": 338,
5+
"clock_cycle_count": 1011,
6+
"hash_table_height": 302,
77
"u32_table_height": 667,
8-
"op_stack_table_height": 862,
8+
"op_stack_table_height": 846,
99
"ram_table_height": 62
1010
},
1111
"case": "CommonCase"
1212
},
1313
{
1414
"name": "tasmlib_list_higher_order_u32_filter_test_hash_xfield_element_lsb",
1515
"benchmark_result": {
16-
"clock_cycle_count": 554,
17-
"hash_table_height": 286,
16+
"clock_cycle_count": 620,
17+
"hash_table_height": 250,
1818
"u32_table_height": 363,
19-
"op_stack_table_height": 504,
19+
"op_stack_table_height": 492,
2020
"ram_table_height": 40
2121
},
2222
"case": "WorstCase"

tasm-lib/benchmarks/tasmlib_list_split_off_xfe.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
{
33
"name": "tasmlib_list_split_off_xfe",
44
"benchmark_result": {
5-
"clock_cycle_count": 509,
6-
"hash_table_height": 144,
5+
"clock_cycle_count": 471,
6+
"hash_table_height": 102,
77
"u32_table_height": 297,
8-
"op_stack_table_height": 551,
8+
"op_stack_table_height": 477,
99
"ram_table_height": 305
1010
},
1111
"case": "CommonCase"
1212
},
1313
{
1414
"name": "tasmlib_list_split_off_xfe",
1515
"benchmark_result": {
16-
"clock_cycle_count": 8489,
17-
"hash_table_height": 144,
16+
"clock_cycle_count": 7881,
17+
"hash_table_height": 102,
1818
"u32_table_height": 7064,
19-
"op_stack_table_height": 9671,
19+
"op_stack_table_height": 8457,
2020
"ram_table_height": 6005
2121
},
2222
"case": "WorstCase"

tasm-lib/benchmarks/tasmlib_memory_memcpy.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
{
33
"name": "tasmlib_memory_memcpy",
44
"benchmark_result": {
5-
"clock_cycle_count": 85,
6-
"hash_table_height": 84,
5+
"clock_cycle_count": 91,
6+
"hash_table_height": 48,
77
"u32_table_height": 49,
8-
"op_stack_table_height": 83,
8+
"op_stack_table_height": 69,
99
"ram_table_height": 34
1010
},
1111
"case": "CommonCase"
1212
},
1313
{
1414
"name": "tasmlib_memory_memcpy",
1515
"benchmark_result": {
16-
"clock_cycle_count": 2834,
17-
"hash_table_height": 84,
16+
"clock_cycle_count": 2626,
17+
"hash_table_height": 48,
1818
"u32_table_height": 2034,
19-
"op_stack_table_height": 3229,
19+
"op_stack_table_height": 2815,
2020
"ram_table_height": 2000
2121
},
2222
"case": "WorstCase"

tasm-lib/src/list/higher_order/filter.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ mod tests {
178178
let input_type = self.f.domain();
179179

180180
let element_size = self.f.domain().stack_size();
181-
let memcpy = MemCpy::rust_shadowing;
182181
let safety_offset = LIST_METADATA_SIZE;
183182

184183
let list_pointer = stack.pop().unwrap();
@@ -193,7 +192,7 @@ mod tests {
193192

194193
// set length
195194
stack.push(output_list);
196-
stack.push(BFieldElement::new(len as u64));
195+
stack.push(bfe!(len));
197196
SetLength.rust_shadow(stack, memory);
198197
stack.pop();
199198

@@ -214,27 +213,17 @@ mod tests {
214213

215214
// maybe copy
216215
if satisfied {
217-
stack.push(
218-
list_pointer
219-
+ BFieldElement::new(
220-
safety_offset as u64 + i as u64 * element_size as u64,
221-
),
222-
); // read source
223-
stack.push(
224-
output_list
225-
+ BFieldElement::new(
226-
safety_offset as u64 + output_index as u64 * element_size as u64,
227-
),
228-
); // write dest
229-
stack.push(BFieldElement::new(element_size as u64)); // number of words
230-
memcpy(&MemCpy, stack, vec![], vec![], memory);
216+
stack.push(list_pointer + bfe!(safety_offset + i * element_size)); // read source
217+
stack.push(output_list + bfe!(safety_offset + output_index * element_size)); // write dest
218+
stack.push(bfe!(element_size)); // number of words
219+
MemCpy.rust_shadow(stack, memory);
231220
output_index += 1;
232221
}
233222
}
234223

235224
// set length
236225
stack.push(output_list);
237-
stack.push(BFieldElement::new(output_index as u64));
226+
stack.push(bfe!(output_index));
238227
SetLength.rust_shadow(stack, memory);
239228
}
240229

0 commit comments

Comments
 (0)