Skip to content

read_waveform spends too much time constructing hightime objects #844

@bkeryan

Description

@bkeryan

Profile results for read_waveform indicate that constructing hightime objects is a bottleneck. These profile results include the proposed fix for #843.

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    73707    0.080    0.000   14.231    0.000 D:\dev\nidaqmx-python\generated\nidaqmx\_feature_toggles.py:148(wrapper)
       18    0.000    0.000   11.648    0.647 D:\dev\nidaqmx-python\tests\benchmark\test_analog_stream_readers.py:78(test___analog_multi_channel_reader___read_waveform)
    51991    0.252    0.000   10.998    0.000 D:\dev\nidaqmx-python\generated\nidaqmx\stream_readers\_analog_multi_channel_reader.py:140(read_waveforms)
    51991    0.314    0.000   10.247    0.000 D:\dev\nidaqmx-python\generated\nidaqmx\_library_interpreter.py:6416(read_analog_waveforms)
     3802    0.126    0.000    6.975    0.002 D:\dev\nidaqmx-python\generated\nidaqmx\_library_interpreter.py:6637(_set_waveform_timings)
    24366    0.722    0.000    6.624    0.000 D:\dev\nidaqmx-python\.venv\lib\site-packages\hightime\_timedelta.py:43(__new__)
        6    0.000    0.000    4.122    0.687 D:\dev\nidaqmx-python\generated\nidaqmx\_library_interpreter.py:6514(_internal_read_analog_waveform_per_chan)
     6090    0.062    0.000    3.417    0.001 D:\dev\nidaqmx-python\.venv\lib\site-packages\hightime\_datetime.py:294(__add__)
       24    0.000    0.000    2.883    0.120 D:\dev\nidaqmx-python\generated\nidaqmx\task\_task.py:1254(wait_until_done)
       24    2.883    0.120    2.883    0.120 D:\dev\nidaqmx-python\generated\nidaqmx\_library_interpreter.py:5961(wait_until_task_done)
    21716    0.055    0.000    2.863    0.000 D:\dev\nidaqmx-python\generated\nidaqmx\stream_readers\_analog_single_channel_reader.py:112(read_waveform)
  1878658    1.887    0.000    2.848    0.000 C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.13\lib\fractions.py:62(__new__)
    21716    0.105    0.000    2.784    0.000 D:\dev\nidaqmx-python\generated\nidaqmx\_library_interpreter.py:6374(read_analog_waveform)
414236/219308    0.204    0.000    1.808    0.000 {built-in method builtins.round}
     6090    0.020    0.000    1.698    0.000 D:\dev\nidaqmx-python\.venv\lib\site-packages\hightime\_timedelta.py:221(__add__)
414222/219294    0.543    0.000    1.695    0.000 C:\Users\Administrator\.pyenv\pyenv-win\versions\3.9.13\lib\fractions.py:505(__round__)
   131574    0.256    0.000    1.544    0.000 D:\dev\nidaqmx-python\generated\nidaqmx\_library_interpreter.py:6615(_invoke_callback)

Originally posted by @bkeryan in #842 (comment)

AB#3330698

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions