-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cost-of-modules reports too small sizes #40
Comments
I was motivated an wrote my own analzyer analyze-module-size which reports the sizes in a slightly different way (output the whole tree with aggregated block-based sizes for each dependency). |
Correct size is definitely the most important thing. Can you share your package.json and I'll look into what's happening |
Great work on analyze module size! |
I have created my test-package with npm init -y
npm install --save though in an empty directory. The package.json is {
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"thought": "^1.1.2"
}
} |
Looping @alshakero in here. Do you think we introduced a bug here: pull/26/files#diff The results of |
I have noticed that "du -h" shows 4k size on my system, even if the file contents is only 100 bytes.
It also shows 4k for directories. The stats show a block size of 4096 for my system, so I just round up file sizes to the next block in analyze-module-size. This quickly adds up if you have a lot of small files and a lot of small modules.
I think even a small file uses a whole block, so counting the blocks should be the correct way of measuring the size. However, the blocks-property of the stats object seems to be based on 512-byte blocks, even if blockSize states 4096.
On TravisCI, the block size seems to be different.
Am 8. Mai 2017 15:15:28 MESZ schrieb Siddharth Kshetrapal <notifications@github.com>:
…Looping @alshakero in here. Do you think we introduced a bug here:
[pull/26/files#diff](https://github.com/siddharthkp/cost-of-modules/pull/26/files#diff-2113531435815bbbba24d4989c5e9451R2)
The results of `fs.readdir` do not match with a `du -k`
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#40 (comment)
--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
|
That makes sense. We used to use Honestly, between correctness and consistency, I don't know what to prefer, because, you do not control the environment in which your npm module will land (talking about libraries here) @nknapp @alshakero What are your thoughts? |
Thinking about it, what is the actual bad experience when installing a bloated package? It's the time it takes for npm install to complete. This may be more related to the number and size of tars that are downloaded. And the time to unpack the tars probably depends more on the number of files than on the unpacked total size.
I want to say that different metrics may be more interesting.
Am 9. Mai 2017 05:20:55 MESZ schrieb Siddharth Kshetrapal <notifications@github.com>:
…That makes sense.
We used to use `du` but that led to inconsistent results on different
environments (let's not even get into windows). That's a bad developer
experience especially if you want to use this in your CI ("works on my
machine" bugs)
Honestly, between correctness and consistency, I don't know what to
prefer, because, you do not control the environment in which your npm
module will land (talking about libraries here)
@nknapp @alshakero What are your thoughts?
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#40 (comment)
--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
|
@nknapp said it perfectly. It has to do with block sizes. However, before I went for FS I compared to windows native stats. And FS delivered exactly the same results, as in So on Windows, I don't think we need to be any more accurate than Windows itself. And I took the numbers I put in fractures from Windows stats. |
I don't know, how important that is to you, but I think that the sizes that are reported are sometimes smaller than the actual sizes. For example
While cost-of-modules only reports 8.43M of this project (that has only a package.json and the
thought
-dependency), whiledu -hs
reports 13M. Maybe it does not take into account, that even a very small file uses 4kb of space, depending on the filesystems block-size.The text was updated successfully, but these errors were encountered: