Skip to content

Conversation

jvoisin
Copy link
Contributor

@jvoisin jvoisin commented Jan 2, 2020

Since the self.filename attribute doesn't change during the lifetime of a SqliteDb object, we can move its relpath transformation in the __init__ method, instead of doing it every time _connect is called, resulting in a ~30% performances in the _connect method.

Since the self.filename attribute doesn't change
during the lifetime of a SqliteDb object,
we can move its relpath transformation in
the init method, instead of doing it every time
_connect is called, resulting in a ~30% performances
gain.
@jvoisin
Copy link
Contributor Author

jvoisin commented Jan 2, 2020

I did some profiling:

Before:
before

After:
after

@codecov-io
Copy link

codecov-io commented Jan 2, 2020

Codecov Report

Merging #912 into master will not change coverage.
The diff coverage is 83.33%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #912   +/-   ##
=======================================
  Coverage   94.12%   94.12%           
=======================================
  Files          86       86           
  Lines       12026    12026           
  Branches     1203     1203           
=======================================
  Hits        11319    11319           
  Misses        572      572           
  Partials      135      135
Impacted Files Coverage Δ
coverage/sqldata.py 92.62% <83.33%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 016af5f...64a3ec7. Read the comment docs.

@nedbat nedbat added this to the 5.0.2 milestone Jan 3, 2020
@nedbat nedbat merged commit aa6d851 into nedbat:master Jan 4, 2020
@nedbat
Copy link
Owner

nedbat commented Jan 4, 2020

Thanks! I'll add you to the contributors list.

@jvoisin jvoisin deleted the optimize_connect branch January 5, 2020 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants