Giter VIP home page Giter VIP logo

Comments (4)

ysmood avatar ysmood commented on July 16, 2024

Good point, I will optimize the performance later. Besides, you can try my another lib nofs.

from yaku.

benjamingr avatar benjamingr commented on July 16, 2024

Looks nice, in bluebird I just Promise.promifiyAll(require("fs")) and have a (close to) 0 overhead wrapper over fs, if I want to map/reduce etc I just use bluebird's utilities.

Your code, uses Yaku's promisification in the test - I expect it to perform an order of magnitude slower if the OS caches the read files. It creates a closure and a bunch of other stuff whenever it reads a file :)

When you optimize promisify I expect it to perform a lot better :)

P.S I wonder - why do you have a readJsonSync function there? That's practially just a require

P.S 2 - why don't you chain in the tests https://github.com/ysmood/nofs/blob/1a0fe800548a8d58862b276c39fb7e960fe0fb41/test/basic.coffee#L51-L53 ?

P.S 3 - this is just Array.prototype.every https://github.com/ysmood/nofs/blob/master/src/utils.coffee#L32-L37

P.S 4 - https://github.com/ysmood/nofs/blob/master/src/utils.coffee#L32-L37 and this is Array.prototype.some

from yaku.

ysmood avatar ysmood commented on July 16, 2024

P.S I wonder - why do you have a readJsonSync function there? That's practially just a require

Because require will cache the file, readJson won't waste your memory.

P.S 2 - why don't you chain in the tests

Coffeescript will auto chain them, or I mistook your meaning.

P.S 3 - this is just Array.prototype.every
Array.prototype.some

Old node don't supports them.

About your performance concern, I agree, but my 1 year experience told me it won't be the bottleneck of a large server side project, the IO itself will alway be the bottleneck. So we don't have to waste too much time on it. A better way is to push node support it natively, such as the browsers provide promise based fetch IO, all the file system operation should also support it internally.

from yaku.

ysmood avatar ysmood commented on July 16, 2024

b336a4d#diff-1f0dd9d666794c01ded659349cb2512eR20

The promisify of Yaku has much less overhead now, the inline codes made the trick.

from yaku.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.