88import time
99from pathlib import PurePosixPath
1010
11- # Add examples to path for Heading component
12- sys .path .insert (0 , "examples" )
1311
1412from tdom import html
1513
16- from mysite .components .heading import Heading
17- from tdom_path import make_path , make_path_nodes , render_path_nodes
14+ from tdom_path import make_path_nodes , render_path_nodes , make_traversable
1815from tdom_path .tree import _walk_tree
1916
2017
@@ -101,9 +98,13 @@ def run_benchmark():
10198
10299 _get_module_files .cache_clear () # Clear cache for cold test
103100
101+ # Add examples to path for Heading component
102+ sys .path .insert (0 , "examples" )
103+ from mysite .components .heading import Heading
104+
104105 results ["make_path_cold" ] = benchmark_operation (
105106 "make_path() - relative (COLD cache)" ,
106- lambda : make_path (Heading , "static/styles.css" ),
107+ lambda : make_traversable (Heading , "static/styles.css" ),
107108 iterations = 100 ,
108109 warmup = False , # No warmup for cold cache test
109110 )
@@ -112,12 +113,12 @@ def run_benchmark():
112113 print ("\n [Warm cache tests - simulating repeated use...]" )
113114 results ["make_path" ] = benchmark_operation (
114115 "make_path() - relative (WARM cache)" ,
115- lambda : make_path (Heading , "static/styles.css" ),
116+ lambda : make_traversable (Heading , "static/styles.css" ),
116117 )
117118
118119 results ["make_path_pkg" ] = benchmark_operation (
119120 "make_path() - package path (WARM)" ,
120- lambda : make_path (None , "tests.fixtures.fake_package:static/styles.css" ),
121+ lambda : make_traversable (None , "tests.fixtures.fake_package:static/styles.css" ),
121122 )
122123
123124 # SSG Simulation: Transform same tree for multiple pages
0 commit comments