This snippet computes the average line length on a web page based on visual layout and line wrapping. It's basically doing:
const lines = pageText.split('\n');
const lineLength = lines.map((line) => line.length);
average(lineLength);
Running test "tests/web-test-runner/basic" (1 of 1)... | |
Executing: `/usr/local/google/home/douglasparker/.cache/bazel/_bazel_douglasparker/fd23369152ca483d39c1138566f81234/execroot/angular_cli/bazel-out/k8-fastbuild/bin/tests/legacy-cli/e2e_node20.sh.runfiles/build_bazel_rules_nodejs/internal/node/_node_bin/node "--test" "/usr/local/google/home/douglasparker/.cache/bazel/_bazel_douglasparker/fd23369152ca483d39c1138566f81234/execroot/angular_cli/bazel-out/k8-fastbuild/bin/tests/legacy-cli/e2e_node20.sh.runfiles/angular_cli/tests/legacy-cli/e2e/utils/test_process.js"` | |
TAP version 13 | |
# ========================================================================================== | |
# Running `npm "install" "@web/test-runner" "--save-dev"` [silent]... | |
# CWD: /usr/local/google/home/douglasparker/Temp/angular-cli-e2e-SHplZN/e2e-test/test-project | |
# ========================================================================================== | |
# Running `ng "test"`... | |
# CWD: /usr/local/google/home/douglasparker/Temp/angular-cli-e |
This attempts to analyze the optimziation behavior in V8 when using HydroActive class and
functional components to try to quantify the performance difference. It uses a local build
of d8
and follows advice in
An Introduction to Speculative Optimization in V8
functional.js
and class.js
contain simplified implementations of defining custom
element methods with the two designs. functional.output
and class.output
contain the
output of running d8
on each file.
[{"args":{"name":"swapper"},"cat":"__metadata","name":"thread_name","ph":"M","pid":0,"tid":0,"ts":0}, | |
{"args":{"name":"Compositor"},"cat":"__metadata","name":"thread_name","ph":"M","pid":14332,"tid":15760,"ts":0}, | |
{"args":{"name":"CrRendererMain"},"cat":"__metadata","name":"thread_name","ph":"M","pid":14968,"tid":14284,"ts":0}, | |
{"args":{"name":"Compositor"},"cat":"__metadata","name":"thread_name","ph":"M","pid":14968,"tid":15636,"ts":0}, | |
{"args":{"name":"CrBrowserMain"},"cat":"__metadata","name":"thread_name","ph":"M","pid":10536,"tid":8436,"ts":0}, | |
{"args":{"name":"ThreadPoolForegroundWorker"},"cat":"__metadata","name":"thread_name","ph":"M","pid":20416,"tid":7900,"ts":0}, | |
{"args":{"name":"CrRendererMain"},"cat":"__metadata","name":"thread_name","ph":"M","pid":14332,"tid":8892,"ts":0}, | |
{"args":{"name":"CrRendererMain"},"cat":"__metadata","name":"thread_name","ph":"M","pid":20416,"tid":14496,"ts":0}, | |
{"args":{"name":"Chrome_IOThread"},"cat":"__metadata","name":"thread_name","ph":"M","pid":10536,"tid":7488,"ts |
"""Starlark script to nicely format providers of a target. | |
Usage: | |
bazel cquery --output starlark --starlark:file ${PATH_TO_THIS_FILE} //path/to/pkg:target | |
If you get "ERROR: --starlark:file :: Unrecognized option: --starlark:file", make sure you are | |
using `bazel cquery` **not** `bazel query`. | |
If you get "Error: Starlark computation cancelled: too many steps", you can try adding | |
`--max_computation_steps=9223372036854775807` to raise the limit to its maximum value. |
/** | |
* Parse a network response as an HTML document fragment, then returns each | |
* top-level element. | |
*/ | |
export async function parseDomFragment(res) { | |
// Parse a fully rendered document fragment from the network response. | |
const html = await res.text(); | |
const contentType = res.headers.get('Content-Type'); | |
if (!contentType) | |
throw new Error('Response has no Content-Type.'); |
Copyright (c) 2023 Douglas Parker | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all |
async function renderPromise(promise) { | |
if (promise.isResolved()) { | |
renderValue(promise.value); | |
} else { | |
renderLoading(); | |
const value = await promise; | |
renderValue(value); | |
} | |
} |
{ | |
"userName": "<github-username>", | |
"pat": "<personal-access-token-generated-from-github>" | |
} |