I am writing a server-side application using JavaScript (Express). So I have to validate one big stream of chars (base 64 string). I kinda know what I want to do and how but I have performance related question.
Consider that the string that is uploaded is really big (up to 5 MB). I have already written couple of functions that should do the validation but I am not aware of what is going on behind the hood.
function validate(str) { .... return bool; } var b64_string = '......'; // <- string can be 5 megabytes if(validate(b64_string) { doSomething(b64_string); } If this was C a stack would be allocated for validate(str) function and there would be 5mb of memory for passed variable.
But what happens in JavaScript engine? Is there any way of sending 'pointer' to function so memory consumption does not get too big? T
Thanks in advance!