WEBVTT

1
00:00:00.000 --> 00:00:05.833
This overview explains how two branches can refer to one subexpression,

2
00:00:05.833 --> 00:00:09.567
and when execution can reuse its value.

3
00:00:09.567 --> 00:00:17.365
Shared storage alone does not guarantee that a later
traversal or call avoids computing the same value again.

4
00:00:17.365 --> 00:00:17.367
Shared storage alone does not guarantee that a later
traversal or call avoids computing the same value again.

5
00:00:17.667 --> 00:00:22.300
Let S be A and B, used by two roots.

6
00:00:22.300 --> 00:00:27.133
The left root combines S with C using or; the right root combines S

7
00:00:27.133 --> 00:00:30.067
with D using exclusive-or.

8
00:00:30.067 --> 00:00:35.033
The same mathematical subexpression occurs in both roots.

9
00:00:35.033 --> 00:00:38.000
For this input, S is one.

10
00:00:38.000 --> 00:00:42.033
The left root computes one or zero, giving one.

11
00:00:42.033 --> 00:00:46.733
The right root computes one exclusive-or one, giving zero.

12
00:00:46.733 --> 00:00:52.867
Both consumers need the same intermediate one, but they produce different final answers.

13
00:00:52.867 --> 00:00:57.333
An evaluation memo can store S during this evaluation.

14
00:00:57.333 --> 00:01:01.633
The first consumer computes it; the second reads the stored value.

15
00:01:01.633 --> 00:01:06.633
Sharing the representation makes that reuse possible, while the evaluator and its memo

16
00:01:06.633 --> 00:01:12.131
scope determine whether the calculation is actually reused.

17
00:01:12.131 --> 00:01:12.133
scope determine whether the calculation is actually reused.

18
00:01:12.133 --> 00:01:15.733
Let S equal A AND B.

19
00:01:15.733 --> 00:01:19.500
Our rule is S AND C AND D, OR S AND E.

20
00:01:19.500 --> 00:01:25.000
The written rule contains two occurrences of S, one in each branch.

21
00:01:25.000 --> 00:01:30.867
A shared graph can replace them with one S node and two outgoing uses.

22
00:01:30.867 --> 00:01:37.300
At A B C D E equal 11011, S is one.

23
00:01:37.300 --> 00:01:42.300
The left branch is zero and the right branch is one, so the final OR is one.

24
00:01:42.300 --> 00:01:47.333
A second root, G, takes S exclusive-or E.

25
00:01:47.333 --> 00:01:51.000
At this assignment, G returns zero.

26
00:01:51.000 --> 00:01:54.933
Both roots can point to the same S identity.

27
00:01:54.933 --> 00:01:59.200
In a deliberately memoized traversal over both roots,

28
00:01:59.200 --> 00:02:04.567
S is computed once and its saved value serves each consumer.

29
00:02:04.567 --> 00:02:08.600
A shared node makes reuse possible.

30
00:02:08.600 --> 00:02:16.667
Whether an executor actually reuses it across
roots or calls depends on its memo and lifecycle.

31
00:02:16.667 --> 00:02:23.467
The candidate companion checks a memoized teaching
executor separately from repository node sharing;

32
00:02:23.467 --> 00:02:26.360
neither demonstrates a speedup.

33
00:02:26.660 --> 00:02:37.507
Return to the opening four-input, two-root graph: S equals A and B, L equals S or C, and R equals S exclusive-or D.

34
00:02:37.507 --> 00:02:40.587
The intervening five-input graph is separate.

35
00:02:40.587 --> 00:02:46.264
Here set A, B, C and D to zero, one, one and zero.

36
00:02:47.014 --> 00:02:51.557
Compute S as zero and one, giving zero.

37
00:02:51.557 --> 00:02:56.948
The left consumer combines it with C one using or, giving one.

38
00:02:56.948 --> 00:03:03.848
The right consumer combines it with D zero using exclusive-or, giving zero.

39
00:03:03.848 --> 00:03:09.439
Sharing an intermediate does not merge the two root operations or their answers.

40
00:03:10.189 --> 00:03:14.070
This case establishes a specific contrast.

41
00:03:14.070 --> 00:03:17.534
One shared value S=0.

42
00:03:17.534 --> 00:03:20.614
Root outputs are still distinct.

43
00:03:20.614 --> 00:03:27.815
Keep the input, intermediate values, and conclusion together when comparing it with the previous case.

44
00:03:27.815 --> 00:03:34.422
The calculated answer belongs to this complete assignment under the stated rule.

45
00:03:34.722 --> 00:03:41.018
A later call can reuse the same compiled graph while beginning with an empty evaluation memo.

46
00:03:41.018 --> 00:03:46.386
Representation reuse and cached numerical results have separate lifetimes.

47
00:03:46.386 --> 00:03:54.520
Inspect the actual API and execution scope before claiming that the second call skips all shared-node calculations.

48
00:03:54.820 --> 00:04:00.837
First reset the four-input graph to A one, B one, C zero and D one.

49
00:04:00.837 --> 00:04:03.580
Its shared value S is one.

50
00:04:03.580 --> 00:04:08.100
Now change only B to zero, keeping A, C and D fixed.

51
00:04:08.100 --> 00:04:12.806
S becomes zero, L becomes zero, and R becomes one.

52
00:04:12.806 --> 00:04:20.446
An old memo entry containing S one is invalid unless its identity includes the input context.

53
00:04:21.196 --> 00:04:29.408
Three counts can differ: unique nodes in the stored graph, evaluations during one call, and cache hits across calls.

54
00:04:29.408 --> 00:04:33.428
A drawing with one S node establishes structure.

55
00:04:33.428 --> 00:04:40.046
A claim about saved execution must also establish how the node values are managed.

56
00:04:40.046 --> 00:04:44.144
Identify the shared node and its consumers.

57
00:04:44.144 --> 00:04:50.444
State the memo and lifecycle boundary before counting saved work.
