angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Confusing project budgets

Open Ghostbird opened this issue 1 year ago • 0 comments

Command

build

Is this a regression?

I don't think so.

Description

When generating a new project, budgets are automatically assigned, however the generated values are really confusing. I accidentally ran into some of these limits. I had to grab a calculator, the build output, make some assumptions, run some calculations, before I could actually understand what these options meant.

It would be nice if these were unambiguous.

The generated project limits rules-as-written are:

  • Initial maximum warning: 500 kilobits
  • Initial maximum error: 1millibit
  • Any component style maximum warning: 2 kilobits
  • Any component style maximum error: 6 kilobits

First of all, let's assume that the the m in m should be M, that's a factor 10⁹ difference, but ¹/₁₀₀₀ bits makes no sense here, since we're talking about real storage here. I've only ever used millibits in calculations on pure information.

I analysed this output:

Budget 500.00 kB was not met by 589.00 kB with a total of 1.06 MB

This quickly points in the direction that the b should be a B, it's bytes, not bits. Finally if I run some calculations on this, it clears up another thing (but the output is faulty here too).

(500 + 589)×10³ ≠ 1.06 × 10⁶ (rules-as-written ISO prefixes) (500 + 589)×2¹⁰ ≠ 1.06 × 10³ × 2¹⁰ (floppy disk megabytes) (500 + 589)×2¹⁰ = 1.06 × 10²⁰ (actually intended ISO/IEC 80000-13 binary prefix standard)

From this I can conclude that the numbers used in calculations are actually using the binary measures according to ISO/IEC 80000 (which is the most common for modern systems AFAIK), and the k should be ki and the m should ultimately be Mi.

As you can see, it's no trivial matter to understand what the configuration file actually means with these values.

While not a big priority, it is annoying.

Minimal Reproduction

ng g new app Check angular.json » project » app » architect » build » configuration » production » budgets

Exception or Error

No response

Your Environment

$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 17.3.6
Node: 22.0.0 (Unsupported)
Package Manager: npm 10.5.1
OS: linux x64

Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1703.6 (cli-only)
@angular-devkit/core         17.3.6 (cli-only)
@angular-devkit/schematics   17.3.6 (cli-only)
@schematics/angular          17.3.6 (cli-only)
    
Warning: The current version of Node (22.0.0) is not supported by Angular.

Anything else relevant?

No response

Ghostbird avatar May 02 '24 12:05 Ghostbird