I'm not at all clear about the source of your numbers.
I benchmarked.
Your code:
Result: Memory usage: 64.3MB CPU:4:54 minutes.
Results: Memory usage: 21.1MB CPU usage: 7.1 seconds.
I find it hard to believe that my code even unoptimized has a 4-fold increase in total memory consumption over shared variables when only one thread has a copy of $oData and all the other threads request individual bits of data on an as-needed basis.
Don't believe; measure.
... I can't possibly see how deep copying 1G of data to each thread (10G total) would be better than 1G held by a server thread and 1K held by 10 client threads (1G+10K total). ...
You are just guessing. I benchmarked.
In reply to Re^4: Sharing XS object?
by BrowserUk
in thread Sharing XS object?
by menth0l
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |