angular/packages
Kristiyan Kostadinov fb65ad157c perf(platform-server): speed up resolution of base (#61392)
The `getBaseHref` method is called several times per request and currently queries through the entire document. We can speed it up by taking advantage of the fact that the `<base>` can only be a direct child of the `<head>` and is usually defined towards the beginning. Below are some benchmarks for a "Hello world" app before and after this change.

### Before:
```
Running 60s test @ http://localhost:4202
100 connections with 10 pipelining factor

┌─────────┬────────┬────────┬────────┬────────┬───────────┬──────────┬─────────┐
│ Stat    │ 2.5%   │ 50%    │ 97.5%  │ 99%    │ Avg       │ Stdev    │ Max     │
├─────────┼────────┼────────┼────────┼────────┼───────────┼──────────┼─────────┤
│ Latency │ 568 ms │ 853 ms │ 901 ms │ 904 ms │ 866.58 ms │ 437.6 ms │ 9915 ms │
└─────────┴────────┴────────┴────────┴────────┴───────────┴──────────┴─────────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┐
│ Stat      │ 1%      │ 2.5%    │ 50%     │ 97.5%   │ Avg     │ Stdev   │ Min     │
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Req/Sec   │ 490     │ 826     │ 1,006   │ 1,643   │ 1,129.3 │ 234.69  │ 490     │
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Bytes/Sec │ 10.4 MB │ 17.4 MB │ 21.3 MB │ 34.7 MB │ 23.9 MB │ 4.96 MB │ 10.3 MB │
└───────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┘

Req/Bytes counts sampled once per second.
# of samples: 60

69k requests in 60.04s, 1.43 GB read
90 errors (90 timeouts)
```

### After

```
Running 60s test @ http://localhost:4202
100 connections with 10 pipelining factor

┌─────────┬────────┬────────┬────────┬─────────┬───────────┬───────────┬─────────┐
│ Stat    │ 2.5%   │ 50%    │ 97.5%  │ 99%     │ Avg       │ Stdev     │ Max     │
├─────────┼────────┼────────┼────────┼─────────┼───────────┼───────────┼─────────┤
│ Latency │ 471 ms │ 831 ms │ 889 ms │ 1668 ms │ 835.91 ms │ 467.89 ms │ 9720 ms │
└─────────┴────────┴────────┴────────┴─────────┴───────────┴───────────┴─────────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬──────────┬────────┬─────────┐
│ Stat      │ 1%      │ 2.5%    │ 50%     │ 97.5%   │ Avg      │ Stdev  │ Min     │
├───────────┼─────────┼─────────┼─────────┼─────────┼──────────┼────────┼─────────┤
│ Req/Sec   │ 390     │ 860     │ 1,145   │ 1,572   │ 1,156.77 │ 222.65 │ 390     │
├───────────┼─────────┼─────────┼─────────┼─────────┼──────────┼────────┼─────────┤
│ Bytes/Sec │ 8.24 MB │ 18.2 MB │ 24.2 MB │ 33.2 MB │ 24.4 MB  │ 4.7 MB │ 8.24 MB │
└───────────┴─────────┴─────────┴─────────┴─────────┴──────────┴────────┴─────────┘

Req/Bytes counts sampled once per second.
# of samples: 60

71k requests in 60.03s, 1.47 GB read
140 errors (140 timeouts)
```

PR Close #61392
2025-05-16 09:03:38 +00:00
..
animations build: remove irrelevant madge circular deps tests (#61156) 2025-05-07 11:28:59 -07:00
bazel refactor: update packages/core:{core,src} to ts_project (#61275) 2025-05-14 12:01:51 +00:00
benchpress build: update cross-repo angular dependencies (#61286) 2025-05-14 10:43:35 +00:00
common refactor: add explicit types for exports relying on inferred call return type (#61312) 2025-05-13 22:45:18 +00:00
compiler build: support new ng_project rule (#61275) 2025-05-14 12:01:51 +00:00
compiler-cli fix(compiler-cli): avoid ECMAScript private field metadata emit (#61227) 2025-05-15 09:45:01 -07:00
core fix(core): Testing should not throw when Zone does not patch test FW APIs (#61376) 2025-05-16 07:53:40 +00:00
docs/di docs: remove outdated/unsupported webworker doc (#49856) 2023-04-17 14:01:41 +00:00
elements build: remove irrelevant madge circular deps tests (#61156) 2025-05-07 11:28:59 -07:00
examples docs: replace EventEmitter with output and self-closing tags in templates (#60910) 2025-04-22 21:42:18 +02:00
forms docs: rename @nodoc to @docs-private (#61194) 2025-05-09 10:23:00 -07:00
language-service refactor: update packages/core:{core,src} to ts_project (#61275) 2025-05-14 12:01:51 +00:00
localize docs: rename @nodoc to @docs-private (#61194) 2025-05-09 10:23:00 -07:00
misc/angular-in-memory-web-api build: update cross-repo angular dependencies (#61286) 2025-05-14 10:43:35 +00:00
platform-browser perf(platform-server): speed up resolution of base (#61392) 2025-05-16 09:03:38 +00:00
platform-browser-dynamic refactor(platform-browser): Deprecate the platform-browser-dynamic package (#61043) 2025-05-15 09:48:15 -07:00
platform-server perf(platform-server): speed up resolution of base (#61392) 2025-05-16 09:03:38 +00:00
private/testing refactor(core): drop unused ngDevMode metrics (#60686) 2025-04-02 14:17:10 +00:00
router refactor(router): add return types to exported functions (#61310) 2025-05-14 08:57:35 -07:00
service-worker build: use common macro to define tsconfig for service worker (#61341) 2025-05-14 10:43:25 -07:00
ssr refactor(core): add REQUEST, RESPONSE_INIT and REQUEST_CONTEXT tokens (#58669) 2024-11-14 14:21:21 -08:00
upgrade build: migrate upgrade to use ng_project instead of ng_module (#61320) 2025-05-14 09:34:28 -07:00
zone.js build: update dependency google-closure-compiler to v20250407 (#61397) 2025-05-16 08:47:18 +00:00
BUILD.bazel build: use common macro to define tsconfig for service worker (#61341) 2025-05-14 10:43:25 -07:00
circular-deps-test.conf.js build: remove circular deps goldens (#60021) 2025-02-19 21:01:31 +00:00
empty.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
goog.d.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
license-banner.txt docs: update license year (#59883) 2025-03-04 19:36:47 +00:00
package.json build: prepare for compiler-cli to be using ts_project (#61181) 2025-05-09 15:59:46 +00:00
README.md docs: fix links to docs (#57391) 2024-08-19 09:20:15 -07:00
system.d.ts refactor: update packages/core:{core,src} to ts_project (#61275) 2025-05-14 12:01:51 +00:00
tsconfig-build.json refactor: update packages/core:{core,src} to ts_project (#61275) 2025-05-14 12:01:51 +00:00
tsconfig-legacy-saucelabs.json feat(core): support TypeScript 5.5 (#56096) 2024-05-29 15:33:33 +02:00
tsconfig-test.json
tsconfig-tsec-base.json refactor(compiler): remove empty empty string suffix from interpolation instructions (#60066) 2025-03-10 16:31:34 -07:00
tsconfig.json refactor: update packages/core:{core,src} to ts_project (#61275) 2025-05-14 12:01:51 +00:00
tsec-exemption.json
types.d.ts refactor: update packages/core:{core,src} to ts_project (#61275) 2025-05-14 12:01:51 +00:00

Angular

The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.

Usage information and reference details can be found in Angular documentation.

License: MIT