C # Threads How to optimize a SELECT with BLOB

2

I have a C # application (.Net 4.5) that when loading a screen among other operations it searches the database for a background image and sounds. It turns out that for some loaded screens this operation (search for images + sounds) takes 29 seconds, which causes a bad experience to the user. I would like to create something so that this time would fall. I implemented 2 Threads one for each operation, but the execution time jumped to 31 seconds. Does anyone have a solution to improve this?

    Task t1 = new Task(CarregarImagens);
    t1.Start();

    Task t2 = new Task(CarregarSons);
    t2.Start();
    
asked by anonymous 16.04.2015 / 17:09

1 answer

2

Threading , by itself, does not make the process faster; the practice allows you to parallelize its processing, which can be a great benefit if your processes enter WaitState frequently.

One solution would be to obtain the images and sounds at an earlier point in the process, in the style of pre-fetching . Thus, resources would be available immediately when the user requests them.

    
16.04.2015 / 17:18