-
- Downloads
Add a flatten() command which takes a string as an argument.
This is to deal with the fact that when you concatenate JS strings, the JS engine simply notes that they are concatenated, but keeps all the original strings around until something flattens them. This code: for(;;) { str += ascii(random(256)); log(str.length); } Fails when str reaches about 256KiB then crashes with out of memory but this code: for(;;) { str += ascii(random(256)); log(str.length); } Reaches a size of 4MB without stopping. Any time you actually paw through the string, it gets flattened, but when you do a bunch of concatenation, manually flattening can be a Good Thing.
Loading
Please register or sign in to comment