mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-05-28 03:46:13 +00:00
Attempt to reduce the number of calls to execute and fetchone.
Profiling has shown that there are many calls to sqlite3.execute and fetchone which takes a signicant amount of time. A simple way of reducing these is to swap the 2-stage init of table row data into a unified add. Applying this to add_set and add_country yielded these results: Before changes ``` 281784 7.054 0.000 7.054 0.000 {method 'execute' of 'sqlite3.Cursor' objects} 127443 1.114 0.000 1.114 0.000 {method 'fetchone' of 'sqlite3.Cursor' objects} ``` After changes ``` 281714 7.492 0.000 7.492 0.000 {method 'execute' of 'sqlite3.Cursor' objects} 127373 1.217 0.000 1.217 0.000 {method 'fetchone' of 'sqlite3.Cursor' objects} ``` Note: The total time of fetchone has actually increased. I am hoping this was an abnormality on my machine and the actual reduction in the number of calls will permantly reduce this total time.
This commit is contained in:
parent
0e4458fa75
commit
0a69894320
2 changed files with 8 additions and 32 deletions
|
@ -44,14 +44,6 @@ create_movie = """
|
|||
SELECT coalesce(max(idMovie), 0)
|
||||
FROM movie
|
||||
"""
|
||||
create_set = """
|
||||
SELECT coalesce(max(idSet), 0)
|
||||
FROM sets
|
||||
"""
|
||||
create_country = """
|
||||
SELECT coalesce(max(country_id), 0)
|
||||
FROM country
|
||||
"""
|
||||
create_musicvideo = """
|
||||
SELECT coalesce(max(idMVideo), 0)
|
||||
FROM musicvideo
|
||||
|
@ -319,12 +311,12 @@ add_unique_id_movie_obj = ["{Unique}", "{MovieId}", "movie", "{UniqueId}", "{Pro
|
|||
add_unique_id_tvshow_obj = ["{Unique}", "{ShowId}", "tvshow", "{UniqueId}", "{ProviderName}"]
|
||||
add_unique_id_episode_obj = ["{Unique}", "{EpisodeId}", "episode", "{UniqueId}", "{ProviderName}"]
|
||||
add_country = """
|
||||
INSERT INTO country(country_id, name)
|
||||
VALUES (?, ?)
|
||||
INSERT INTO country(name)
|
||||
VALUES (?)
|
||||
"""
|
||||
add_set = """
|
||||
INSERT INTO sets(idSet, strSet, strOverview)
|
||||
VALUES (?, ?, ?)
|
||||
INSERT INTO sets(strSet, strOverview)
|
||||
VALUES (?, ?)
|
||||
"""
|
||||
add_set_obj = ["{Title}", "{Overview}"]
|
||||
add_musicvideo = """
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue