We’ve developed some resources to help you work effectively from home during COVID-19 Click to learn more

Support for NSStream instead of Byte[]

Hi all,

In 8.5R08, we introduce support for using NSStream for most methods where you use Byte[] today, specifically including all HTTP operations. Arrays in CRMScript carry a certain overhead for each element, and consequently large arrays (such a a Byte[] for a HTTP-downloaded image) consume way more memory than just the image data. NSStreams are much more efficient because they are just one CRMScript variable instance for the whole content.

We have new functions that accept NSStream as a parameter, such as encodeBase64(NSStream) which have the same name as the old Byte[] function, since parameter type is sufficient to differentiate the functions. Functions/methods returning data need a unique name as well, so they have become e.g. HTTP.getAsStream(), in comparison to the old HTTP.get().

On my computer, fetching a 5MB picture using NSStream and then printing it was apx 4 times faster than using Byte[]. Enjoy :) 


Inga svar ännu!