Skip to content

Commit 8a49185

Browse files
committed
Optimize scrollytelling: lazy cards, dynamic CDF agents, perf hints
1 parent 1eba4fc commit 8a49185

4 files changed

Lines changed: 19 additions & 27 deletions

File tree

‎src/components/intro/Intro.CDF.svelte‎

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,29 +52,15 @@
5252
return cdfPoints;
5353
}
5454
55-
// Process data for all three agents
55+
// Process data for all agents dynamically
5656
$: cdfData =
5757
data.length > 0
58-
? [
59-
{
60-
agent: AGENT_IDS.CLAUDE,
61-
agentName: AGENT_NAMES[AGENT_IDS.CLAUDE],
62-
color: AGENT_COLORS[AGENT_IDS.CLAUDE],
63-
values: calculateCDF(AGENT_IDS.CLAUDE, data)
64-
},
65-
{
66-
agent: AGENT_IDS.GPT5,
67-
agentName: AGENT_NAMES[AGENT_IDS.GPT5],
68-
color: AGENT_COLORS[AGENT_IDS.GPT5],
69-
values: calculateCDF(AGENT_IDS.GPT5, data)
70-
},
71-
{
72-
agent: AGENT_IDS.HUMAN,
73-
agentName: AGENT_NAMES[AGENT_IDS.HUMAN],
74-
color: AGENT_COLORS[AGENT_IDS.HUMAN],
75-
values: calculateCDF(AGENT_IDS.HUMAN, data)
76-
}
77-
]
58+
? Object.values(AGENT_IDS).map((agentId) => ({
59+
agent: agentId,
60+
agentName: AGENT_NAMES[agentId],
61+
color: AGENT_COLORS[agentId],
62+
values: calculateCDF(agentId, data)
63+
})).filter(d => d.values.length > 0)
7864
: [];
7965
8066
// Determine which agent is selected

‎src/components/intro/Intro.svelte‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
<IntroAgents bind:this={introAgentsRef} {scrollIndex} {scrollyContainer} />
124124
<IntroCDF {scrollIndex} />
125125
</div>
126-
<Scrolly bind:value={scrollIndex} bind:container={scrollyContainer}>
126+
<Scrolly bind:value={scrollIndex} bind:container={scrollyContainer} increments={25}>
127127
<!-- Step 0: Opening prompt -->
128128
<div class="step">
129129
<div class="step-inner">
@@ -209,7 +209,9 @@
209209
210210
.sticky {
211211
width: 100%;
212-
height: 100svh;
212+
height: 100dvh;
213+
will-change: transform;
214+
contain: layout style paint;
213215
position: sticky;
214216
display: flex;
215217
flex-direction: column;
@@ -233,7 +235,7 @@
233235
}
234236
235237
.step:first-of-type {
236-
margin-top: calc(-100svh + 6rem);
238+
margin-top: calc(-100dvh + 6rem);
237239
}
238240
239241
.step-inner {

‎src/components/pages/BlogPage.svelte‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@
6666
<Slider bind:this={sliderEl} bind:current={$currAgentSlide}>
6767
{#each agents as agent, i}
6868
<Slide index={i}>
69-
<AgentCard {agent} />
69+
{#if Math.abs(i - $currAgentSlide) <= 1}
70+
<AgentCard {agent} />
71+
{:else}
72+
<div class="agent-card-placeholder" style="min-height: 400px;" />
73+
{/if}
7074
</Slide>
7175
{/each}
7276
</Slider>

‎src/routes/player/[...recordingPath]/+page.svelte‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
? Number(benchmark["oracle/nop"])
4242
: undefined;
4343
$: benchmarkPath =
44-
benchmark?.benchmark_decoposed || benchmark?.benchmark_without_params || "";
44+
benchmark?.benchmark_decomposed || benchmark?.benchmark_without_params || "";
4545
4646
// Reactive theme subscription
4747
let currentTheme;
@@ -122,7 +122,7 @@
122122
>
123123
</div>
124124
<div class="metric">
125-
<span class="metric-label">Expert Human speedup</span>
125+
<span class="metric-label">Oracle speedup</span>
126126
<span class="metric-value highlight"
127127
>{oracleSpeed !== undefined
128128
? `${oracleSpeed.toFixed(4)}x`

0 commit comments

Comments
 (0)