On Tue, Jul 30, 2013 at 8:46 AM, Benjamin Pasero <[email protected]> wrote: >> ok, so far I have not heard a technical reason. the fact that require() >> returns module.exports obviously would have to change to AMD require with >> callback. And the order of modules could probably be ensured by using a >> similar approach as requireJS load order >> (http://requirejs.org/docs/1.0/docs/api.html#order).
There are no doubt modules on npm that implement AMD-style module loading. If there aren't, you should be able to implement it quite easily. That said, I don't think I/O will be your only bottleneck when loading 10k JS files (unless none of those files are in the operating system's file cache, then I/O will probably dominate). I expect that V8 will spend a non-negligible amount of CPU time parsing and compiling all that source code. On a final note, asynchronous file I/O is relatively slow in node.js. Each call to fs.open(), fs.read() and fs.close() translates into a round-trip to a thread pool of limited size (defaults to 4 threads, configurable with the UV_THREADPOOL_SIZE environment variable which is clamped to the range 1-128.) What that means is that you can fire off 10k concurrent file I/O requests but the _effective_ concurrency is the size of the thread pool. Effective thread pool management is a topic of ongoing research but it's hard. With many kinds of workloads, having more threads actually _decreases_ the rate of throughput rather than increase it. I have alternative thread pool implementations sitting in branches that speed up some workloads 10x while slowing down others by that same amount or more. :-( -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
