@@ -39,14 +39,31 @@ def reexport_in_memory(filepath: str, output_folder: Optional[str] = None):
3939 if output_folder :
4040 os .makedirs (output_folder , exist_ok = True )
4141 path_in_memory = f"{ output_folder } /{ path_in_memory .split ('/' )[- 1 ]} "
42- epc = Epc .read_file (epc_file_path = filepath , read_rels_from_files = False )
42+ epc = Epc .read_file (epc_file_path = filepath , read_rels_from_files = False , recompute_rels = False )
4343
4444 if os .path .exists (path_in_memory ):
4545 os .remove (path_in_memory )
4646 epc .export_file (path_in_memory )
4747
4848
49- def time_comparison (filepath : str , output_folder : Optional [str ] = None , skip_sequential : bool = True ):
49+ def reexport_in_memory_par_read (filepath : str , output_folder : Optional [str ] = None ):
50+ path_in_memory = filepath .replace (".epc" , "_in_memory_par_read.epc" )
51+ if output_folder :
52+ os .makedirs (output_folder , exist_ok = True )
53+ path_in_memory = f"{ output_folder } /{ path_in_memory .split ('/' )[- 1 ]} "
54+ epc = Epc .read_file (epc_file_path = filepath , read_rels_from_files = False , read_parallel = True , recompute_rels = False )
55+
56+ if os .path .exists (path_in_memory ):
57+ os .remove (path_in_memory )
58+ epc .export_file (path_in_memory , parallel = True )
59+
60+
61+ def time_comparison (
62+ filepath : str ,
63+ output_folder : Optional [str ] = None ,
64+ skip_sequential_stream : bool = True ,
65+ skip_parallel_stream : bool = True ,
66+ ):
5067 """Compare performance of different EPC reexport methods."""
5168 print (f"\n { '=' * 70 } " )
5269 print (f"Performance Comparison: { filepath .split ('/' )[- 1 ]} " )
@@ -62,7 +79,15 @@ def time_comparison(filepath: str, output_folder: Optional[str] = None, skip_seq
6279 results .append (("In-Memory (Epc)" , elapsed_inmem ))
6380 print (f" ✓ Completed in { elapsed_inmem :.3f} s\n " )
6481
65- if not skip_sequential :
82+ # Test 1b: In-Memory with Parallel Read
83+ print ("⏳ Testing In-Memory EPC processing with Parallel Read..." )
84+ start = time .perf_counter ()
85+ reexport_in_memory_par_read (filepath , output_folder )
86+ elapsed_inmem_par = time .perf_counter () - start
87+ results .append (("In-Memory (Epc) Parallel Read" , elapsed_inmem_par ))
88+ print (f" ✓ Completed in { elapsed_inmem_par :.3f} s\n " )
89+
90+ if not skip_sequential_stream :
6691 # Test 2: Streaming Sequential
6792 print ("⏳ Testing Streaming Sequential processing..." )
6893 start = time .perf_counter ()
@@ -72,12 +97,13 @@ def time_comparison(filepath: str, output_folder: Optional[str] = None, skip_seq
7297 print (f" ✓ Completed in { elapsed_seq :.3f} s\n " )
7398
7499 # Test 3: Streaming Parallel
75- print ("⏳ Testing Streaming Parallel processing..." )
76- start = time .perf_counter ()
77- reexport_stream_parallel (filepath , output_folder )
78- elapsed_parallel = time .perf_counter () - start
79- results .append (("Stream Parallel" , elapsed_parallel ))
80- print (f" ✓ Completed in { elapsed_parallel :.3f} s\n " )
100+ if not skip_parallel_stream :
101+ print ("⏳ Testing Streaming Parallel processing..." )
102+ start = time .perf_counter ()
103+ reexport_stream_parallel (filepath , output_folder )
104+ elapsed_parallel = time .perf_counter () - start
105+ results .append (("Stream Parallel" , elapsed_parallel ))
106+ print (f" ✓ Completed in { elapsed_parallel :.3f} s\n " )
81107
82108 # Calculate speedups
83109 results_sorted = sorted (results , key = lambda x : x [1 ])
@@ -119,15 +145,15 @@ def time_comparison(filepath: str, output_folder: Optional[str] = None, skip_seq
119145
120146 update_prop_kind_dict_cache ()
121147
122- time_comparison (
123- filepath = sys .argv [1 ] if len (sys .argv ) > 1 else "rc/epc/testingPackageCpp22.epc" ,
124- output_folder = "rc/performance_results" ,
125- )
126-
127148 # time_comparison(
128- # filepath=sys.argv[1] if len(sys.argv) > 1 else "rc/epc/80wells_surf.epc", output_folder="rc/performance_results"
149+ # filepath=sys.argv[1] if len(sys.argv) > 1 else "rc/epc/testingPackageCpp22.epc",
150+ # output_folder="rc/performance_results",
129151 # )
130152
153+ time_comparison (
154+ filepath = sys .argv [1 ] if len (sys .argv ) > 1 else "rc/epc/80wells_surf.epc" , output_folder = "rc/performance_results"
155+ )
156+
131157 # time_comparison(
132158 # filepath=sys.argv[1] if len(sys.argv) > 1 else "wip/failingData/fix/sample_mini_firp_201_norels_with_media.epc",
133159 # output_folder="rc/performance_results",
0 commit comments