iotaledger / entangled

enTangle'd is an amalgamation of all things Tangle
Apache License 2.0
113 stars 66 forks source link

flex_trits_slice: use memcpy for aligned buffers #1379

Closed semenov-vladyslav closed 5 years ago

semenov-vladyslav commented 5 years ago

Use memcpy in flex_trits_slice when buffers are aligned, i.e. start is on the boundary of flex_trit_t.

Test Plan:

The changes in the code are similar for TE3, TE4, and TE5; the difference is in handling tails. test_flex_trits_slice in tests seem to cover edge cases and succeed for trit_encoding equal 3, 4, and 5. Simple benchmark works as expected: 10M transaction deserializations work in 7 seconds.