Skip to content

Commit 6569585

Browse files
flakey5metcoder95
andauthored
More cache fixes (#3955)
* More cache fixes Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Carlos Fuentes <me@metcoder.dev> * code review, fixes --------- Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com> Co-authored-by: Carlos Fuentes <me@metcoder.dev>
1 parent d6f45b1 commit 6569585

File tree

90 files changed

+1002
-54187
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1002
-54187
lines changed
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Update Cache Tests
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 0 * * *'
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
update-cache-tests:
14+
name: Update Cache Tests
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Git Config
18+
run: |
19+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
20+
git config --global user.name "github-actions[bot]"
21+
22+
- name: Checkout Repository
23+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
24+
25+
- name: Update Cache Tests
26+
run: |
27+
rm -rf test/fixtures/cache-tests && mkdir test/fixtures/cache-tests &&
28+
29+
git clone https://github.com/http-tests/cache-tests --depth=1 test/fixtures/tmp-cache-tests/ &&
30+
31+
mv test/fixtures/tmp-cache-tests/LICENSE test/fixtures/cache-tests/LICENSE &&
32+
mv test/fixtures/tmp-cache-tests/tests test/fixtures/cache-tests/tests &&
33+
mv test/fixtures/tmp-cache-tests/test-engine test/fixtures/cache-tests/test-engine &&
34+
mv test/fixtures/tmp-cache-tests/results test/fixtures/cache-tests/results &&
35+
36+
rm -rf tests/fixtures/tmp-cache-tests/
37+
38+
- name: Create Pull Request
39+
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
40+
with:
41+
base: main
42+
branch: cache-tests-update
43+
title: Update Cache Tests
44+
body: Automated update of the Cache Test Suite
45+
commit-message: "chore: update cache tests"

benchmarks/cache/date.mjs

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
'use strict'
2+
3+
import { group, bench, run } from 'mitata'
4+
import { parseHttpDate } from '../../lib/util/date.js'
5+
6+
const DATES = [
7+
// IMF
8+
'Sun, 06 Nov 1994 08:49:37 GMT',
9+
'Thu, 18 Aug 1950 02:01:18 GMT',
10+
'Wed, 11 Dec 2024 23:20:57 GMT',
11+
'Wed, aa Dec 2024 23:20:57 GMT',
12+
'aaa, 06 Dec 2024 23:20:57 GMT',
13+
'Wed, 01 aaa 2024 23:20:57 GMT',
14+
'Wed, 6 Dec 2024 23:20:07 GMT',
15+
'Wed, 06 Dec 2024 3:20:07 GMT',
16+
'Wed, 06 Dec 2024 23:1:07 GMT',
17+
'Wed, 06 Dec 2024 23:01:7 GMT',
18+
'Wed, 06 Dec aaaa 23:01:07 GMT',
19+
'Wed, 06 Dec 2024 aa:01:07 GMT',
20+
'Wed, 06 Dec 2024 23:aa:07 GMT',
21+
'Wed, 06 Dec 2024 23:01:aa GMT',
22+
23+
// RFC850
24+
'Sunday, 06-Nov-94 08:49:37 GMT',
25+
'Thursday, 18-Aug-50 02:01:18 GMT',
26+
'Wednesday, 11-Dec-24 23:20:57 GMT',
27+
'Wednesday, aa Dec 2024 23:20:57 GMT',
28+
'aaa, 06 Dec 2024 23:20:57 GMT',
29+
'Wednesday, 01-aaa-24 23:20:57 GMT',
30+
'Wednesday, 6-Dec-24 23:20:07 GMT',
31+
'Wednesday, 06-Dec-24 3:20:07 GMT',
32+
'Wednesday, 06-Dec-24 23:1:07 GMT',
33+
'Wednesday, 06-Dec-24 23:01:7 GMT',
34+
'Wednesday, 06 Dec-aa 23:01:07 GMT',
35+
'Wednesday, 06-Dec-24 aa:01:07 GMT',
36+
'Wednesday, 06-Dec-24 23:aa:07 GMT',
37+
'Wednesday, 06-Dec-24 23:01:aa GMT',
38+
39+
// asctime()
40+
'Sun Nov 6 08:49:37 1994',
41+
'Thu Aug 18 02:01:18 1950',
42+
'Wed Dec 11 23:20:57 2024',
43+
'Wed Dec aa 23:20:57 2024',
44+
'aaa Dec 06 23:20:57 2024',
45+
'Wed aaa 01 23:20:57 2024',
46+
'Wed Dec 6 23:20:07 2024',
47+
'Wed Dec 06 3:20:07 2024',
48+
'Wed Dec 06 23:1:07 2024',
49+
'Wed Dec 06 23:01:7 2024',
50+
'Wed 06 Dec 23:01:07 aaaa',
51+
'Wed Dec 06 aa:01:07 2024',
52+
'Wed Dec 06 23:aa:07 2024',
53+
'Wed Dec 06 23:01:aa 2024'
54+
]
55+
56+
group(() => {
57+
bench('parseHttpDate', () => {
58+
for (const date of DATES) {
59+
parseHttpDate(date)
60+
}
61+
})
62+
63+
bench('new Date()', () => {
64+
for (const date of DATES) {
65+
// eslint-disable-next-line no-new
66+
new Date(date)
67+
}
68+
})
69+
})
70+
71+
await run()

0 commit comments

Comments
 (0)