Skip to content

Parse recordings once and reuse numeric parser state - #872

Closed
Andrey1994 wants to merge 4 commits into
masterfrom
perf/file-reader-601
Closed

Andrey1994 wants to merge 4 commits into
masterfrom
perf/file-reader-601

Conversation

@Andrey1994

@Andrey1994 Andrey1994 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

File loading constructs a stream per numeric token and the bindings parse the recording twice. Reuse one classic-locale numeric stream and add immutable read snapshots so Python and C# parse once, then copy into caller-owned output. C# also avoids the intermediate flat-to-matrix copy. Existing C entry points remain available; counting validates input without retaining all parsed values.

Snapshots have explicit prepare/copy/release operations, capacity checks, and shared ownership for concurrent copy/release. Bindings release them in finally blocks. Strict finite-number, token, delimiter, shape, and output-capacity validation is preserved.

Validation: MSVC Release /MT native build; 20 Python signal-processing tests and C# regression executable passed against the newly built DLL. Added malformed-input, snapshot lifetime/file-change, capacity/no-write-on-error, released-handle coverage, and concurrent copies racing release with no partial output. Tests use the existing Windows/Unix CI suites. A local 4 MB recording took 0.47–0.49 s after warm-up, versus the previous 1.05–1.24 s baseline; this is an operation-specific local measurement.

Also repair the shared CI failures: stage native dylibs beside the macOS C# regression executable, report C++ test exceptions through a nonzero exit status, and guard allocation failure/overflow in the macOS Bluetooth pipe resize.

Part of #601. Based directly on master and independent of #871.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T00:56:29.988884Z c284db9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

System.IO.File.WriteAllText(path, "1,2\n3,4");
var loaded = DataFilter.read_file(path);
if (loaded.GetLength(0) != 2 || loaded.GetLength(1) != 2 ||
loaded[0, 1] != 3 || loaded[1, 0] != 2)
System.IO.File.WriteAllText(path, "1,2\n3,4");
var loaded = DataFilter.read_file(path);
if (loaded.GetLength(0) != 2 || loaded.GetLength(1) != 2 ||
loaded[0, 1] != 3 || loaded[1, 0] != 2)
[DllImport ("DataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
public static extern int read_file (double[] data, int[] num_rows, int[] num_cols, string file_name, int max_elements);
[DllImport ("DataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
public static extern int prepare_file_read (string file_name, int[] handle, int[] rows, int[] cols);
[DllImport ("DataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
public static extern int prepare_file_read (string file_name, int[] handle, int[] rows, int[] cols);
[DllImport ("DataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
public static extern int copy_file_read (int handle, double[,] data, int capacity);
switch (PlatformHelper.get_library_environment ())
{
case LibraryEnvironment.x64:
return DataHandlerLibrary64.prepare_file_read (file_name, handle, rows, cols);
case LibraryEnvironment.x64:
return DataHandlerLibrary64.prepare_file_read (file_name, handle, rows, cols);
case LibraryEnvironment.x86:
return DataHandlerLibrary32.prepare_file_read (file_name, handle, rows, cols);
switch (PlatformHelper.get_library_environment ())
{
case LibraryEnvironment.x64:
return DataHandlerLibrary64.copy_file_read (handle, data, capacity);
case LibraryEnvironment.x64:
return DataHandlerLibrary64.copy_file_read (handle, data, capacity);
case LibraryEnvironment.x86:
return DataHandlerLibrary32.copy_file_read (handle, data, capacity);
switch (PlatformHelper.get_library_environment ())
{
case LibraryEnvironment.x64:
return DataHandlerLibrary64.release_file_read (handle);
case LibraryEnvironment.x64:
return DataHandlerLibrary64.release_file_read (handle);
case LibraryEnvironment.x86:
return DataHandlerLibrary32.release_file_read (handle);
@Andrey1994 Andrey1994 closed this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant