Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Commit 9c15a2a

Browse files
committed
Test the optimistic runtime parser
See projectfluent/fluent.js#289
1 parent 62d78c7 commit 9c15a2a

File tree

4 files changed

+547
-0
lines changed

4 files changed

+547
-0
lines changed

error.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default class FluentError extends Error {}

index.html

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<!doctype html>
2+
<meta charset="utf8">
3+
<title>Fluent Runtime Performance</title>
4+
<style>
5+
html {
6+
font: 1rem/1.3 Helvetica, Arial, sans-serif;
7+
padding: 10vh 10vw;
8+
max-width: 30rem;
9+
background: #fcfcfc;
10+
color: #111;
11+
}
12+
13+
legend {
14+
padding: .33rem .66rem;
15+
font-style: italic;
16+
}
17+
18+
label {
19+
margin-top: 1rem;
20+
display: block;
21+
}
22+
23+
#results {
24+
margin-top: 1rem;
25+
}
26+
27+
button {
28+
padding: .33rem .66rem;
29+
}
30+
</style>
31+
32+
<script type="module">
33+
import test from "./test.js";
34+
window.test = test;
35+
</script>
36+
37+
<h1>Fluent Runtime</h1>
38+
39+
<p>
40+
Measure the time it takes to parse a long Fluent resource. The test is
41+
run only once to simulate the real-world conditions and to de-bias it
42+
from the impact of the JIT compilation.
43+
</p>
44+
45+
<fieldset>
46+
<legend>Constructed Resource Settings</legend>
47+
48+
<label for="messages">Number of messages: <span>10</span></label>
49+
<input id="messages"
50+
oninput="this.previousElementSibling.firstElementChild.textContent = this.value"
51+
type="range" min="0" max="100" step="10" value="10">
52+
53+
<label for="paragraphs">Number of paragraphs in each message: <span>10</span></label>
54+
<input id="paragraphs"
55+
oninput="this.previousElementSibling.firstElementChild.textContent = this.value"
56+
type="range" min="0" max="100" step="10" value="10">
57+
</fieldset>
58+
59+
<div id="results">
60+
<button onclick="test()">Parse</button>
61+
Elapsed time: <span id="elapsed">???</span> ms
62+
</div>

0 commit comments

Comments
 (0)