collerek/ormar

`translate_list_to_dict` method is a bottleneck

sorasful opened this issue · 2 comments

These days I'm trying to profile several of my routes, and I notice that it's not the DB calls that takes the most time, but more what comes after, especially translate_list_to_dict function.

I've profiled them with cProfile and the results are always the same, this function take almost 50% of the time.

Here are 2 screenshots:

image
image

Describe the solution you'd like
I'm wondering if this is a known issue, maybe we can try to brainstorm on how to improve this to take less time ?

Also, i've noticed that check_node_not_dict_or_not_last_node function is being called a huge number of time for a limited number of rows. Maybe there's something we can do about it too.

These days I'm trying to profile several of my routes, and I notice that it's not the DB calls that takes the most time, but more what comes after, especially translate_list_to_dict function.

I've profiled them with cProfile and the results are always the same, this function take almost 50% of the time.

Here are 2 screenshots:

image image

Describe the solution you'd like I'm wondering if this is a known issue, maybe we can try to brainstorm on how to improve this to take less time ?

Also, i've noticed that check_node_not_dict_or_not_last_node function is being called a huge number of time for a limited number of rows. Maybe there's something we can do about it too.

Thanks for your advise, and paste the test code, will fix and test it please.

@sorasful Did you check again after updating to 12.1?