Skip to content

Huge typed array

Michael Chang edited this page Apr 14, 2016 · 2 revisions

If you have to pass 32k uint8 as input, TArray may be too slow. With ArrayBuffer and memory.bind, data transfer will be blazingly fast.

let ab = new ArrayBuffer(32*1024); // 32K bytes buffer
let u8 = new Uint8Array(ab); // typed array
memory.exec(ab, function(){
  GWorld.MySuperMemoryFunction();
});

Bound array buffer can be accessed with FArrayBufferAccessor. After handshaking with javascript, native handles huge amount of memory safely.

void UMyBlueprintFunctionLibrary::MySuperMemoryFunction(UWorld* World)
{
    auto size = FArrayBufferAccessor::GetSize();
    auto buffer = FArrayBufferAccessor::GetData();
}
Clone this wiki locally
You can’t perform that action at this time.