Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rokenbuzz
Level 7

ifArray.Append needs start_pos and length parameters

I'm finding a lack of functions to move raw bytes around in arrays. I can write my own brightscript functions but they are insanely slow compared to if these are implemented in the underlying component architecture.
For example, roByteArray has ifArray.Append which is blazing fast compared to any equivalent I can write in brightscript. That's great, but it has no start_pos and length. So if I want to copy the middle 1000 bytes out of an roByteArray of 8000, without looping in my own brightscript, what can I do?
ifByteArray.AppendFile and ifByteArray.ReadFile have start_pos and length parameters, so these could be used as a hackish work-around, writing to file and reading back to an roByteArray to accomplish this. I had some hope, figuring tmp:/ must just be memory anyway, but I'm profiling ifArray.Append and ifByteArray.AppendFile (with no start_pos and length params) and finding it's 10 times slower to use the file.
Am I missing some basic array copy methods?
As a quick fix, having ifArray.Append with start_pos and length parameters would help tremendously.

rokenbuzz

0 Kudos
1 Reply
rokenbuzz
Level 7

Re: ifArray.Append needs start_pos and length parameters

I found this thread from 10 years ago asking for the same thing and also pointing out file I/O as a possible work around.

https://community.roku.com/t5/Roku-Developer-Program/New-Telnet-Functions/td-p/111837/page/4

After a decade there is still no method for copying bytes.
Is it time?

 

0 Kudos