arfoundation-samples icon indicating copy to clipboard operation
arfoundation-samples copied to clipboard

Deserial & Reading of Worldmaps SLOWER than in old ARKit

Open smxthereisonlyone opened this issue 7 years ago • 4 comments

Hey,

using a device with iOS 13 plus either a) old ARKit plugin vs b) ARFoundation package create two different read and write speeds von worldmaps although the relocalization speed and accuracy is the same. The older ARKit plugin being much faster. Sometimes ARFoundation deserializes for up to 1 minute. Why is that? @tdmowrer

Thanks for any insight :)

smxthereisonlyone avatar Sep 02 '19 15:09 smxthereisonlyone

i'm using a device with ios13 as well. it takes quite long to load but not a minute. How much space do you scan? it even crashes sometimes for me. when I try to scan more than just the current floor but multiple rooms I can load the data afterwards but it crashes after a few seconds

ghost avatar Sep 03 '19 13:09 ghost

I suspect this to be a difference between iOS 12 and 13. The ARKit XR Plugin uses the same code as the BitBucket plugin to deserialize the ARWorldMap (just a call to NSKeyedUnarchiver).

And because the ARKit XR Plugin operates on raw bytes instead of filenames, I would expect it to be faster, as loading a file from disk is not part of the API. What specific function call is slow? How are you timing it?

it even crashes sometimes for me...I can load the data afterwards but it crashes after a few seconds

What is the callstack?

tdmowrer avatar Sep 04 '19 04:09 tdmowrer

Looks like our world map sample limits its file read to 10,240 bytes per frame, so if you have copied this method and are loading a large world map, it would be quite slow. This is just sample code -- it is up to you to obtain the bytes of the world map.

A simple File.ReadAllBytes would be much faster. However, this blocks the main thread while reading, which is why the sample only reads a small number of bytes per frame.

If ARWorldMap.TryDeserialize is indeed slow, please provide precise timing data along with the number of bytes deserialized.

tdmowrer avatar Sep 05 '19 05:09 tdmowrer

Closing issue as this seems to be an artifact of the sample code, which intentionally breaks up the file reading over multiple frames. Please reopen if it continues to be an issue.

tdmowrer avatar Oct 06 '19 06:10 tdmowrer