Skip to content

Performance improvement#155

Merged
hakancelikdev merged 9 commits intomasterfrom
i150
Dec 17, 2020
Merged

Performance improvement#155
hakancelikdev merged 9 commits intomasterfrom
i150

Conversation

@hakancelikdev
Copy link
Copy Markdown
Owner

No description provided.

@hakancelikdev hakancelikdev marked this pull request as draft December 11, 2020 21:35
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 11, 2020

Codecov Report

Merging #155 (948fc74) into master (372a144) will increase coverage by 1.40%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #155      +/-   ##
==========================================
+ Coverage   95.68%   97.08%   +1.40%     
==========================================
  Files           9        8       -1     
  Lines         625      617       -8     
==========================================
+ Hits          598      599       +1     
+ Misses         27       18       -9     
Impacted Files Coverage Δ
unimport/config.py 100.00% <100.00%> (+2.17%) ⬆️
unimport/constants.py 100.00% <100.00%> (ø)
unimport/scan.py 100.00% <100.00%> (ø)
unimport/utils.py 79.54% <100.00%> (+12.87%) ⬆️

@hakancelikdev
Copy link
Copy Markdown
Owner Author

%98.4

Before

         184079878 function calls (180082579 primitive calls) in 54.555 seconds

   Ordered by: internal time
   List reduced from 1864 to 10 due to restriction <10>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     5341   20.940    0.004   26.185    0.005 /usr/lib/python3.8/ast.py:254(_splitlines_no_ff)
98670318/98669693    5.276    0.000    5.745    0.000 {built-in method builtins.len}
  7093225    3.176    0.000    6.392    0.000 /usr/lib/python3.8/ast.py:214(iter_child_nodes)
     5335    3.096    0.001    3.096    0.001 {built-in method builtins.compile}
 13617145    2.681    0.000    3.667    0.000 /usr/lib/python3.8/ast.py:202(iter_fields)
  1098828    2.211    0.000    5.633    0.000 /usr/lib/python3.8/tokenize.py:429(_tokenize)
1536624/1369    1.850    0.000   35.016    0.026 /usr/lib/python3.8/ast.py:365(generic_visit)
19104686/19099729    1.599    0.000    1.601    0.000 {built-in method builtins.isinstance}
 10280653    1.398    0.000    1.398    0.000 {built-in method builtins.getattr}
  1026143    1.042    0.000    1.042    0.000 {method 'match' of 're.Pattern' objects}

After

         83036364 function calls (79039267 primitive calls) in 27.494 seconds

   Ordered by: internal time
   List reduced from 1862 to 10 due to restriction <10>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
  7092867    3.135    0.000    6.230    0.000 /usr/lib/python3.8/ast.py:214(iter_child_nodes)
     5335    2.972    0.001    2.972    0.001 {built-in method builtins.compile}
 13616497    2.554    0.000    3.498    0.000 /usr/lib/python3.8/ast.py:202(iter_fields)
  1098786    2.213    0.000    5.637    0.000 /usr/lib/python3.8/tokenize.py:429(_tokenize)
1536538/1369    1.814    0.000    8.317    0.006 /usr/lib/python3.8/ast.py:365(generic_visit)
19103847/19098890    1.559    0.000    1.561    0.000 {built-in method builtins.isinstance}
 10280183    1.345    0.000    1.346    0.000 {built-in method builtins.getattr}
  1026105    1.038    0.000    1.038    0.000 {method 'match' of 're.Pattern' objects}
  1997358    0.922    0.000    5.127    0.000 /usr/lib/python3.8/ast.py:325(walk)
     5150    0.910    0.000    7.975    0.002 /home/hakan/Desktop/unimport/unimport/relate.py:5(relate)

@hakancelikdev hakancelikdev linked an issue Dec 11, 2020 that may be closed by this pull request
@hakancelikdev hakancelikdev added changelog Changes should be written to the changelog file. refactor labels Dec 11, 2020
@hakancelikdev
Copy link
Copy Markdown
Owner Author

After the last commit

77575444 function calls (71914951 primitive calls) in 23.082 seconds

Ordered by: internal time
List reduced from 1844 to 10 due to restriction <10>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     6091    3.701    0.001    3.701    0.001 {built-in method builtins.compile}
  7270946    3.047    0.000    6.098    0.000 /usr/lib/python3.8/ast.py:214(iter_child_nodes)
 16298178    2.920    0.000    3.978    0.000 /usr/lib/python3.8/ast.py:202(iter_fields)
2444156/2125    2.608    0.000    9.965    0.005 /usr/lib/python3.8/ast.py:365(generic_visit)
 12945575    1.599    0.000    1.599    0.000 {built-in method builtins.getattr}
20926736/20921796    1.595    0.000    1.596    0.000 {built-in method builtins.isinstance}
2508573/2125    1.201    0.000    9.970    0.005 /usr/lib/python3.8/ast.py:359(visit)
  2046668    0.895    0.000    4.986    0.000 /usr/lib/python3.8/ast.py:325(walk)
     5187    0.875    0.000    7.782    0.002 /home/hakan/Desktop/unimport/unimport/relate.py:5(relate)
  1976482    0.544    0.000    3.894    0.000 {method 'extend' of 'collections.deque' objects}

@hakancelikdev hakancelikdev marked this pull request as ready for review December 13, 2020 19:06
@hakancelikdev hakancelikdev merged commit eb45dc9 into master Dec 17, 2020
@hakancelikdev hakancelikdev deleted the i150 branch December 17, 2020 00:32
hakancelikdev added a commit that referenced this pull request Jul 16, 2022
* Remove recovery comments & use end_col_offset -> %98.4

* Fix: #120, #150, Configuring fix, session remove, More accurate results, doc update

* Test config & remove unused lines

* no unimport section test add

* Fix the issue mentioned in #120

* Pass relevant configurations from main to Scanner init

* FAQ docs update

* Fix attr name & #120 assign

* Add beta in setup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog Changes should be written to the changelog file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance regression unimport doesn't remove previous imports when there is an assignment with the imported module's name

1 participant