JimHokanson / matlab_standard_library

Standard Library for my Matlab Projects
MIT License
8 stars 10 forks source link

mex or regexp boolean transitions #42

Open JimHokanson opened 7 years ago

JimHokanson commented 7 years ago

identifying boolean transitions is apparently a bottleneck in running some code.

+sl+array\bool_transition_info.

obj.true_start_indices = find(~temp_logic(1:end-1) & temp_logic(2:end)); obj.false_start_indices = find(temp_logic(1:end-1) & ~temp_logic(2:end));

The goal is to make this faster.

I was thinking of using mex, but I wonder if regexp might work just as well ...

JimHokanson commented 7 years ago

I think we will need to use mex to avoid memory duplication. With find, I've always wondered if it is faster to look twice or to expand the memory as you go.

I think I've run into a similar problem before and considered using a goto based state machine:

States:

Also note that a logical is 1 byte, so we could use 2 as a sentinel.

Would probably also benefit from using jump tables.