Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

perf(http): reduce data transfer when using HTTP caching#52347

Closed
alan-agius4 wants to merge 2 commits intoangular:mainangular/angular:mainfrom
alan-agius4:http-cache-alan-agius4/angular:http-cache-Copy head branch name to clipboard
Closed

perf(http): reduce data transfer when using HTTP caching#52347
alan-agius4 wants to merge 2 commits intoangular:mainangular/angular:mainfrom
alan-agius4:http-cache-alan-agius4/angular:http-cache-Copy head branch name to clipboard

Conversation

@alan-agius4
Copy link
Contributor

This commit reduces the property size in the http transfer cache to reduce the page payload.

Before

<script id="ng-state" type="application/json">
{
  "4155228514": {
    "body": "....",
    "headers": {},
    "status": 200,
    "statusText": "OK",
    "url": "http://foo.com/assets/media.json",
    "responseType": "json"
  },
}
</script>

Now

<script id="ng-state" type="application/json">
{
  "4155228514": {
    "b": "....",
    "h": {},
    "s": 200,
    "st": "OK",
    "u": "http://foo.com/assets/media.json",
    "rt": "json"
  },
}
</script>

@HyperLife1119
Copy link
Contributor

How about using tuples?

@alan-agius4
Copy link
Contributor Author

How about using tuples?

I went with a similar approach that is used for other things like hydration. Also with tuples, it feel like it would be harder to visually read what is written in the cache.

@alan-agius4 alan-agius4 added area: common/http Issues related to HTTP and HTTP Client target: patch This PR is targeted for the next patch release labels Oct 24, 2023
@ngbot ngbot bot added this to the Backlog milestone Oct 24, 2023
@alan-agius4 alan-agius4 added the area: server Issues related to server-side rendering label Oct 24, 2023
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 24, 2023
@alan-agius4 alan-agius4 marked this pull request as ready for review October 24, 2023 14:29
packages/common/http/src/transfer_cache.ts Outdated Show resolved Hide resolved
This commit reduces the property size in the http transfer cache to reduce the page payload.

Before
```html
<script id="ng-state" type="application/json">
{
  "4155228514": {
    "body": "....",
    "headers": {},
    "status": 200,
    "statusText": "OK",
    "url": "http://foo.com/assets/media.json",
    "responseType": "json"
  },
}
</script>
```

Now
```html
<script id="ng-state" type="application/json">
{
  "4155228514": {
    "b": "....",
    "h": {},
    "s": 200,
    "st": "OK",
    "u": "http://foo.com/assets/media.json",
    "rt": "json"
  },
}
</script>
```
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 馃憤

@AndrewKushnir AndrewKushnir removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 24, 2023
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker target: rc This PR is targeted for the next release-candidate and removed target: patch This PR is targeted for the next patch release labels Oct 24, 2023
@dylhunn
Copy link
Contributor

dylhunn commented Oct 24, 2023

This PR was merged into the repository by commit c5e30f1.

@dylhunn dylhunn closed this in c5e30f1 Oct 24, 2023
dylhunn pushed a commit that referenced this pull request Oct 24, 2023
This commit reduces the property size in the http transfer cache to reduce the page payload.

Before
```html
<script id="ng-state" type="application/json">
{
  "4155228514": {
    "body": "....",
    "headers": {},
    "status": 200,
    "statusText": "OK",
    "url": "http://foo.com/assets/media.json",
    "responseType": "json"
  },
}
</script>
```

Now
```html
<script id="ng-state" type="application/json">
{
  "4155228514": {
    "b": "....",
    "h": {},
    "s": 200,
    "st": "OK",
    "u": "http://foo.com/assets/media.json",
    "rt": "json"
  },
}
</script>
```

PR Close #52347
@alan-agius4 alan-agius4 deleted the http-cache- branch October 25, 2023 05:07
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 25, 2023
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
This commit reduces the property size in the http transfer cache to reduce the page payload.

Before
```html
<script id="ng-state" type="application/json">
{
  "4155228514": {
    "body": "....",
    "headers": {},
    "status": 200,
    "statusText": "OK",
    "url": "http://foo.com/assets/media.json",
    "responseType": "json"
  },
}
</script>
```

Now
```html
<script id="ng-state" type="application/json">
{
  "4155228514": {
    "b": "....",
    "h": {},
    "s": 200,
    "st": "OK",
    "u": "http://foo.com/assets/media.json",
    "rt": "json"
  },
}
</script>
```

PR Close angular#52347
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: common/http Issues related to HTTP and HTTP Client area: server Issues related to server-side rendering target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.