I am dealing with a stream of data on serial port. The baud rate is 19200 kbps, leaving a shot time (about 100 ms) to process data and display the result on the screen.
There is no issue with data processing performance. The main problem is updating the screen. The application specification needs me to show data in a tabular view. Cell contexts in this view might have different colours based on the information they indicate. For example red for errors, green or blue for some kinds of messages and etc.
Currently, I am using a datagridview to display the data as it has a flexible tabular view, and its cells has ForeColor property to change the colour. But, it is too slow compared to the input data and processing rate. Specifically, when I add new rows on new data arrival or remove old rows from the beginning. To add and remove a row I use the DGV.Rows.Add(...), and DGV.Rows.RemoveAt(...) methods.
I considered two approaches:
1) Two different threads for processing data and updating UI. However, as data processing is much faster than operations on datagridview, data will be accumulated and finally slow down everything.
2) Processing data and update the screen sequentially. In this case, after processing of each message, the message will be displayed on the screen (will be added to the datagridview), and the next will be processed after the screen update. Obviously, this way decreases the processing speed which in not desirable.
So, I am wondering if there is any better ways to handle this condition... or if I am not using the right control in terms of the performance for this purpose.
Thanks.