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

v3 proposal #2982

Open
wants to merge 97 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
c636c2f
Enable ES2015 lint and minifier code gen support
dead-claudia Sep 26, 2024
3e97cc9
Optimize generated IIFE slightly
dead-claudia Sep 26, 2024
f07feb9
Add keyed perf tests, assert no duplicates in keyed fragments
dead-claudia Sep 26, 2024
f291d28
Add duplicate key check, deduplicate code, use ES6
dead-claudia Sep 26, 2024
0106367
Normalize xlink, simplify attrs update a bit
dead-claudia Sep 26, 2024
c3e90f5
Drop `m.trust` support
dead-claudia Sep 26, 2024
ca65f7a
Drop object component support
dead-claudia Sep 27, 2024
e9fad45
`key` attr -> `m.key(...)`, drop `domSize`, remove redundancy
dead-claudia Oct 2, 2024
2707de3
Use the `.state` property for keys
dead-claudia Oct 2, 2024
ae28e2a
Move the DOM event listener to `vnode.instance`
dead-claudia Oct 2, 2024
7aca843
Move state object creation to hyperscript
dead-claudia Oct 2, 2024
b724902
Move `m.render` out of initialization closure
dead-claudia Oct 2, 2024
3ade35c
Drop `m.request`
dead-claudia Oct 3, 2024
a452105
Migrate `m.buildPathname` to `m.p` and remove the path params argumen…
dead-claudia Oct 3, 2024
8c619c3
Add a `m.withProgress` to replace `onprogress` with `fetch`.
dead-claudia Oct 3, 2024
1b0818e
Have `m.mount` mount a view function rather than a full component
dead-claudia Oct 3, 2024
6caacf2
Drop a couple forgotten tests
dead-claudia Oct 3, 2024
57edf21
Add lazy loader
dead-claudia Oct 3, 2024
6b3c7b3
Toss the "route" part of the router
dead-claudia Oct 3, 2024
ccea9a1
Merge `Vnode` with the hyperscript module
dead-claudia Oct 3, 2024
dae2208
Rename and move lone remaining `pathname` submodule to make more sense
dead-claudia Oct 3, 2024
3668dc7
Drop remaining reference to `assign`
dead-claudia Oct 3, 2024
03fd640
Merge query string building into `m.p`, drop unused query string parser
dead-claudia Oct 3, 2024
eb0031c
Normalize the callback style in `test-p.js`.
dead-claudia Oct 3, 2024
b04519d
Make the event dictionary a proper class
dead-claudia Oct 3, 2024
8fbc46a
Finish ES6ifying hyperscript factories
dead-claudia Oct 3, 2024
1418bd3
Drop stale recycling tests
dead-claudia Oct 3, 2024
13c2e63
Add `m.tracked` utility for tracking delayed removals
dead-claudia Oct 3, 2024
cd20a00
Make `m.lazy` not a higher-order factory - it doesn't need to be one
dead-claudia Oct 3, 2024
454f8e7
Drop `onbeforeremove`
dead-claudia Oct 3, 2024
60de2e1
`onbeforeremove` -> `m.retain()`
dead-claudia Oct 4, 2024
1efdb78
Re-duplicate children
dead-claudia Oct 4, 2024
537f828
Drop `handleEvent` method support, wait for promises in event listeners
dead-claudia Oct 4, 2024
9070429
Revise a comment
dead-claudia Oct 4, 2024
5c2bf31
Drop `oninit`, replace all remaining lifecycle methods with `m.layout`
dead-claudia Oct 4, 2024
2942ea5
Drop old vnode state stuff except for components
dead-claudia Oct 4, 2024
168b403
Add `m.init` and `m.use` convenience utilities, simplify fragments, f…
dead-claudia Oct 4, 2024
b168f74
Migrate components to simple functions and closures
dead-claudia Oct 4, 2024
d652f98
Drop `m.fragment`, try to create attrs object less in hyperscript fac…
dead-claudia Oct 4, 2024
bd09d8a
Stop propagating hooks, correct the circular rendering check
dead-claudia Oct 4, 2024
933d4b5
Improve perf tests
dead-claudia Oct 5, 2024
d7d8bef
Simplify the keyed diff fuzzer
dead-claudia Oct 5, 2024
67a30f4
Simplify the renderer, strip outdated and redundant tests, reject reu…
dead-claudia Oct 5, 2024
84b0950
Split code + tests, move source into dedicated directory
dead-claudia Oct 5, 2024
49ec364
Redo build and pack system, simplify a few remaining bits
dead-claudia Oct 5, 2024
55a8071
Knock out all the intermediate closures, do a better job cleaning up,…
dead-claudia Oct 6, 2024
c0821cb
Try to get a better profile view
dead-claudia Oct 6, 2024
210d997
Improve bundle size, move to type masks to boost performance
dead-claudia Oct 11, 2024
044d1b8
Switch from `m.layout` signal out `m.remove`, merge create/update cal…
dead-claudia Oct 11, 2024
8ddc288
Add context, migrate router to use it
dead-claudia Oct 11, 2024
21085ce
Rearrange tests to mirror source
dead-claudia Oct 11, 2024
beaad3b
Optimize stream, remove deprecated bit, simplify `combine`
dead-claudia Oct 11, 2024
84472c4
Move `redraw` to an options bag
dead-claudia Oct 11, 2024
70cc05b
Move router functions to arrow functions to save a little space
dead-claudia Oct 11, 2024
1cf9de3
`undefined` -> `null` to save a few bytes
dead-claudia Oct 12, 2024
455765a
Add bi-edge debouncing + throttling rate limiters
dead-claudia Oct 12, 2024
118d748
Stub out error handling
dead-claudia Oct 12, 2024
4137f97
Fix stray outdated benchmark reference
dead-claudia Oct 12, 2024
313d004
Add ops per sec counter
dead-claudia Oct 12, 2024
726e79f
Optimize error handling
dead-claudia Oct 12, 2024
2a60973
Ensure `is` is always set in custom elements
dead-claudia Oct 12, 2024
f48beca
Normalize the render vnode input to a single unitary vnode, not an array
dead-claudia Oct 12, 2024
b889448
Clean up the router on remove, remove unneeded hashchange event
dead-claudia Oct 12, 2024
3b7788b
Remove the no-longer-necessary options parameter to `{add,remove}Even…
dead-claudia Oct 12, 2024
95897a3
Diff final URL before redrawing, to prevent unnecessary redraws
dead-claudia Oct 12, 2024
966d1c0
Allow building query strings independently of paths (again)
dead-claudia Oct 12, 2024
30e5ed1
Restore current size
dead-claudia Oct 12, 2024
86b3c31
Update the copy a bit, drop official IE support
dead-claudia Oct 12, 2024
2872ca2
Stop displaying size in the README
dead-claudia Oct 12, 2024
9099bcc
Forgot to port the actual key assignment over in the benchmark
dead-claudia Oct 12, 2024
1fb5104
Unrestrict a bunch of actually valid syntax
dead-claudia Oct 20, 2024
c5c4b2f
Add `m.match`, optimize `m.p` a ton
dead-claudia Oct 20, 2024
fa39b98
Remove some useless `Object.assign`s
dead-claudia Oct 20, 2024
310a32b
Remove unnecessary `finally` block
dead-claudia Oct 20, 2024
b33349a
Improve post-perf UI a little
dead-claudia Oct 20, 2024
3da7a1d
Pre-render tree in benchmark so it's only checking update in `render …
dead-claudia Oct 20, 2024
01fc41e
ES6ify an event handler (and fix its name)
dead-claudia Oct 20, 2024
9dd8d17
Improve benchmark more
dead-claudia Oct 21, 2024
fee0cca
Boost `m.p` performance by a lot
dead-claudia Oct 21, 2024
451aa18
Tolerate absence of `/dist`
dead-claudia Oct 21, 2024
36d4cb3
Resolve remaining issues with benchmarks, explain with a lengthy just…
dead-claudia Oct 29, 2024
2e75897
Address some feedback around naming and (indirectly) `m.key`, optimiz…
dead-claudia Oct 30, 2024
5018ad0
Move context to `this` argument
dead-claudia Oct 30, 2024
5d79b07
Make routed links more concise, stop throwing when retaining nothing,…
dead-claudia Oct 30, 2024
f99850e
Further simplify routing
dead-claudia Oct 30, 2024
0c99734
Use `queueMicrotask` to avoid some awkward `await 0`s.
dead-claudia Oct 30, 2024
814261f
Add more type checks, unify auto-redraw logic, optimize element creat…
dead-claudia Oct 30, 2024
cd26097
Revise an outdated comment, cheat a little bit on redraw context
dead-claudia Oct 30, 2024
8cafcfe
Fix a type comment, make things use a shared noop where helpful
dead-claudia Oct 30, 2024
953665e
Add a single-value tracker, optimize tracked handle.
dead-claudia Oct 31, 2024
3220a25
Bring back `m.request` - it's too useful.
dead-claudia Oct 31, 2024
76389d4
Avoid splicing samples
dead-claudia Nov 4, 2024
17e89ea
Add Node.js types for a better autocomplete experience in scripts
dead-claudia Nov 4, 2024
584069f
Optimize the style property update flow and reduce its overhead
dead-claudia Nov 6, 2024
7c5d9b7
Revise some test names
dead-claudia Nov 7, 2024
77e7ea7
Update core.js
dead-claudia Mar 26, 2025
8bfbe6b
Update core.js
dead-claudia Mar 26, 2025
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
Prev Previous commit
Next Next commit
Improve benchmark more
dead-claudia committed Oct 21, 2024
commit 9dd8d17f1fb17b0bf0201e30cc8c5b921ee114a5
45 changes: 29 additions & 16 deletions performance/test-perf.js
Original file line number Diff line number Diff line change
@@ -91,27 +91,33 @@ benchmarks["null test"] = (b) => {
} while (!b.done())
}

const {routes, vars, templates} = (() => {
const {routes, stringVars, numVars, templates} = (() => {
const routes = []
const vars = []
const stringVars = []
const numVars = []
const templates = []

for (let i = 0; i < 16; i++) {
for (let j = 0; j < 16; j++) {
templates.push(`/foo${i}/:id${i}/bar${j}/:sub${j}`)
routes.push(`/foo${i}/${i}/bar${j}/${j}`)
vars.push({
stringVars.push({
[`id${i}`]: `${i}`,
[`sub${j}`]: `${j}`,
})
numVars.push({
[`id${i}`]: i,
[`sub${j}`]: j,
})
}
}

return {
// Flatten everything, since they're usually flat strings in practice.
routes: JSON.parse(JSON.stringify(routes)).map((path) => ({path, params: new URLSearchParams()})),
templates: JSON.parse(JSON.stringify(templates)),
vars: JSON.parse(JSON.stringify(vars)),
stringVars: JSON.parse(JSON.stringify(stringVars)),
numVars: JSON.parse(JSON.stringify(numVars)),
}
})()

@@ -129,9 +135,10 @@ benchmarks["route match"] = (b) => {
} while (!b.done())
}

// This needs to be at most a few microseconds, as 300 of these * 3 us/op = 0.9 ms. (And yes, while
// 300 may seem like a lot, I've worked with apps that exceeded 100, and for 60 FPS, you only truly
// have room for about 5ms total for logic.)
// These four need to be at most a few microseconds, as 300 of these * 3 us/op = 0.9 ms. (And yes,
// while 300 may seem like a lot, I've worked with apps that exceeded 100, and for 60 FPS, you only
// truly have room for about 5ms total for logic.)

benchmarks["route non-match"] = (b) => {
let i = 0
do {
@@ -145,25 +152,31 @@ benchmarks["route non-match"] = (b) => {
} while (!b.done())
}

// This needs to be at most a few microseconds, as 300 of these * 3 us/op = 0.9 ms. (And yes, while
// 300 may seem like a lot, I've worked with apps that exceeded 100, and for 60 FPS, you only truly
// have room for about 5ms total for logic.)
benchmarks["path generate with vars"] = (b) => {
benchmarks["path generate with string interpolations"] = (b) => {
let i = 0
do {
cycleRoot()
do {
// eslint-disable-next-line no-bitwise
i = (i - 1) & 255
globalThis.test = m.p(templates[i], stringVars[i])
} while (!b.tick())
} while (!b.done())
}

benchmarks["path generate with number interpolations"] = (b) => {
let i = 0
do {
cycleRoot()
do {
// eslint-disable-next-line no-bitwise
i = (i - 1) & 255
globalThis.test = m.p(templates[i], vars[i])
globalThis.test = m.p(templates[i], numVars[i])
} while (!b.tick())
} while (!b.done())
}

// This needs to be at most a few microseconds, as 300 of these * 3 us/op = 0.9 ms. (And yes, while
// 300 may seem like a lot, I've worked with apps that exceeded 100, and for 60 FPS, you only truly
// have room for about 5ms total for logic.)
benchmarks["path generate no vars"] = (b) => {
benchmarks["path generate no interpolations"] = (b) => {
let i = 0
do {
cycleRoot()