Skip to content
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

More cache fixes #3955

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/update-cache-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Update Cache Tests

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'

permissions:
contents: write
pull-requests: write

jobs:
update-cache-tests:
name: Update Cache Tests
runs-on: ubuntu-latest
steps:
- name: Git Config
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"

- name: Checkout Repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

- name: Update WPT
flakey5 marked this conversation as resolved.
Show resolved Hide resolved
run: |
rm -rf test/fixtures/cache-tests && mkdir test/fixtures/cache-tests &&

git clone https://github.com/http-tests/cache-tests --depth=1 test/fixtures/tmp-cache-tests/ &&

mv test/fixtures/tmp-cache-tests/LICENSE test/fixtures/cache-tests/LICENSE &&
mv test/fixtures/tmp-cache-tests/tests test/fixtures/cache-tests/tests &&
mv test/fixtures/tmp-cache-tests/test-engine test/fixtures/cache-tests/test-engine &&
mv test/fixtures/tmp-cache-tests/results test/fixtures/cache-tests/results &&

rm -rf tests/fixtures/tmp-cache-tests/

- name: Create Pull Request
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
base: main
branch: cache-tests-update
title: Update Cache Tests
body: Automated update of the Cache Test Suite
commit-message: "chore: update cache tests"
71 changes: 71 additions & 0 deletions benchmarks/cache/date.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
'use strict'

import { group, bench, run } from 'mitata'
import { parseHttpDate } from '../../lib/util/date.js'

const DATES = [
// IMF
'Sun, 06 Nov 1994 08:49:37 GMT',
'Thu, 18 Aug 1950 02:01:18 GMT',
'Wed, 11 Dec 2024 23:20:57 GMT',
'Wed, aa Dec 2024 23:20:57 GMT',
'aaa, 06 Dec 2024 23:20:57 GMT',
'Wed, 01 aaa 2024 23:20:57 GMT',
'Wed, 6 Dec 2024 23:20:07 GMT',
'Wed, 06 Dec 2024 3:20:07 GMT',
'Wed, 06 Dec 2024 23:1:07 GMT',
'Wed, 06 Dec 2024 23:01:7 GMT',
'Wed, 06 Dec aaaa 23:01:07 GMT',
'Wed, 06 Dec 2024 aa:01:07 GMT',
'Wed, 06 Dec 2024 23:aa:07 GMT',
'Wed, 06 Dec 2024 23:01:aa GMT',

// RFC850
'Sunday, 06-Nov-94 08:49:37 GMT',
'Thursday, 18-Aug-50 02:01:18 GMT',
'Wednesday, 11-Dec-24 23:20:57 GMT',
'Wednesday, aa Dec 2024 23:20:57 GMT',
'aaa, 06 Dec 2024 23:20:57 GMT',
'Wednesday, 01-aaa-24 23:20:57 GMT',
'Wednesday, 6-Dec-24 23:20:07 GMT',
'Wednesday, 06-Dec-24 3:20:07 GMT',
'Wednesday, 06-Dec-24 23:1:07 GMT',
'Wednesday, 06-Dec-24 23:01:7 GMT',
'Wednesday, 06 Dec-aa 23:01:07 GMT',
'Wednesday, 06-Dec-24 aa:01:07 GMT',
'Wednesday, 06-Dec-24 23:aa:07 GMT',
'Wednesday, 06-Dec-24 23:01:aa GMT',

// asctime()
'Sun Nov 6 08:49:37 1994',
'Thu Aug 18 02:01:18 1950',
'Wed Dec 11 23:20:57 2024',
'Wed Dec aa 23:20:57 2024',
'aaa Dec 06 23:20:57 2024',
'Wed aaa 01 23:20:57 2024',
'Wed Dec 6 23:20:07 2024',
'Wed Dec 06 3:20:07 2024',
'Wed Dec 06 23:1:07 2024',
'Wed Dec 06 23:01:7 2024',
'Wed 06 Dec 23:01:07 aaaa',
'Wed Dec 06 aa:01:07 2024',
'Wed Dec 06 23:aa:07 2024',
'Wed Dec 06 23:01:aa 2024'
]

group(() => {
bench('parseHttpDate', () => {
for (const date of DATES) {
parseHttpDate(date)
}
})

bench('new Date()', () => {
for (const date of DATES) {
// eslint-disable-next-line no-new
new Date(date)
}
})
})

await run()
Loading
Loading