Skip to content

Commit e0bb444

Browse files
authored
Merge branch 'main' into fix/issue11893
2 parents 4b81322 + a1badd7 commit e0bb444

File tree

6 files changed

+1066
-1015
lines changed

6 files changed

+1066
-1015
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Notes for monitoring performance on Linux
2+
3+
Context: I've been having trouble getting consistent performance measurements on my MacBook Pro, so I decided to try my luck on an Intel Linux desktop running Ubuntu 24.
4+
5+
## `perf` settings
6+
7+
We'll want to monitor some performance counters that have potential security implications, so we need to disable some settings. ONLY DO THIS ON A MACHINE YOU TRUST AND THAT WILL NOT RUN POTENTIALLY-MALICIOUS THIRD-PARTY CODE!
8+
9+
### Source `scripts/linux-perf-settings.sh`
10+
11+
(These come from <https://easyperf.net/blog/2019/08/02/Perf-measurement-environment-on-Linux>)
12+
13+
### `sysctl.conf` settings
14+
15+
```
16+
$ cat /proc/sys/kernel/perf_event_paranoid
17+
```
18+
19+
If the result isn't `-1`, then add this to `/etc/sysctl.conf`:
20+
21+
```
22+
kernel.perf_event_paranoid = -1
23+
```
24+
25+
```
26+
$ cat /proc/sys/kernel/kptr_restrict
27+
```
28+
29+
If the result isn't `0`, then add this to `/etc/sysctl.conf`:
30+
31+
```
32+
kernel.kptr_restrict = 0
33+
```
34+
35+
After these changes, you'll need to reboot.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# This assumes intel processors!!
4+
5+
# Intel
6+
echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo
7+
# AMD
8+
# echo 0 > /sys/devices/system/cpu/cpufreq/boost
9+
10+
for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
11+
do
12+
echo performance > $i
13+
done
14+
15+
echo 0 > /proc/sys/kernel/randomize_va_space
16+

src/command/render/pandoc.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ import {
204204
import { kFieldCategories } from "../../project/types/website/listing/website-listing-shared.ts";
205205
import { isWindows } from "../../deno_ral/platform.ts";
206206
import { appendToCombinedLuaProfile } from "../../core/performance/perfetto-utils.ts";
207+
import { makeTimedFunctionAsync } from "../../core/performance/function-times.ts";
207208

208209
// in case we are running multiple pandoc processes
209210
// we need to make sure we capture all of the trace files
@@ -1233,14 +1234,18 @@ export async function runPandoc(
12331234

12341235
setupPandocEnv();
12351236

1237+
const pandocRender = makeTimedFunctionAsync("pandoc-render", async () => {
1238+
return await execProcess(
1239+
{
1240+
cmd,
1241+
cwd,
1242+
env: pandocEnv,
1243+
},
1244+
);
1245+
});
1246+
12361247
// run pandoc
1237-
const result = await execProcess(
1238-
{
1239-
cmd,
1240-
cwd,
1241-
env: pandocEnv,
1242-
},
1243-
);
1248+
const result = await pandocRender();
12441249

12451250
// run afterPandoc hooks
12461251
for (const hook of afterPandocHooks) {

src/resources/filters/ast/customnodes.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function is_regular_node(node, name)
4141
return node
4242
end
4343

44-
function run_emulated_filter(doc, filter, traverse)
44+
function run_emulated_filter(doc, filter, traverser)
4545
if doc == nil then
4646
return nil
4747
end
@@ -82,10 +82,10 @@ function run_emulated_filter(doc, filter, traverse)
8282
elseif type(traverser) == 'function' then
8383
_quarto.traverser = traverser
8484
else
85-
warn('Unknown traverse method: ' .. tostring(traverse))
85+
warn('Unknown traverse method: ' .. tostring(traverser))
8686
end
8787
local result = _quarto.traverser(node, filter_param)
88-
_quarto.traverse = old_traverse
88+
_quarto.traverser = old_traverse
8989

9090
return result
9191
end

src/resources/filters/normalize/astpipeline.lua

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,15 @@
33

44
function quarto_ast_pipeline()
55
local function warn_on_stray_triple_colons()
6-
local function block_handler(block)
7-
_quarto.ast.walk(block, {
8-
Str = function(el)
6+
return {
7+
Str = function(el)
98
if string.match(el.text, ":::(:*)") then
109
local error_message =
1110
"\nThe following string was found in the document: " .. el.text ..
12-
"\nThis string was found in a block element with the following content:\n\n" .. pandoc.utils.stringify(block) ..
1311
"\n\nThis usually indicates a problem with a fenced div in the document. Please check the document for errors."
1412
warn(error_message)
1513
end
16-
end
17-
})
18-
end
19-
return {
20-
Para = block_handler,
21-
Plain = block_handler,
14+
end
2215
}
2316
end
2417
return {

0 commit comments

Comments
 (0)