Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PERF: additonal GIL releasing #10213

Closed
6 of 12 tasks
jreback opened this issue May 27, 2015 · 10 comments
Closed
6 of 12 tasks

PERF: additonal GIL releasing #10213

jreback opened this issue May 27, 2015 · 10 comments
Labels
Closing Candidate May be closeable, needs more eyeballs Performance Memory or execution speed performance

Comments

@jreback
Copy link
Contributor

jreback commented May 27, 2015

after #10199 (all of the groupbys)
these require slightly different templates as the object cannot have the with nogil:. These are all in pandas/src/generate_code.py

- [ ] groupby_count
- [ ] is_monotonic

  • take_1d
  • take_2d
  • take_2d_multi
  • pad
  • backfill
  • diff
  • join_indexer (outer/inner/left)

in algos.pyx

  • kthsmallest/kthlargest
  • group_median
  • roll_*
  • drop_duplicates machinery
  • nancorr
@jreback jreback added Performance Memory or execution speed performance Difficulty Intermediate labels May 27, 2015
@jreback jreback added this to the 0.17.0 milestone May 27, 2015
@jreback jreback modified the milestones: Next Major Release, 0.17.0 Aug 15, 2015
@mrocklin
Copy link
Contributor

I've run up against drop_duplicates a bit recently. I'd bump that slightly in priority here. No specific rush though.

@jreback
Copy link
Contributor Author

jreback commented Aug 27, 2015

ints

In [41]: np.random.seed(1234)

In [42]: N = 1000000

In [43]: df = DataFrame({'A' : np.random.randint(0,100,size=N)})

In [44]: def f():
   ....:     for i in range(2):
   ....:         df.drop_duplicates()
   ....:         

In [45]: @test_parallel(2)
   ....: def g():
   ....:     df.drop_duplicates()
   ....:     

In [46]: %timeit f()
10 loops, best of 3: 86.3 ms per loop

In [47]: %timeit g()
10 loops, best of 3: 54.8 ms per loop

objects

In [48]: idx = tm.makeStringIndex(100)

In [49]: df = DataFrame({'A' : idx.take(np.random.randint(0,100,size=N))})

In [50]: %timeit f()
10 loops, best of 3: 244 ms per loop

In [51]: %timeit g()
10 loops, best of 3: 168 ms per loop

@mrocklin what dtypes are you typically dropping? note that dropping on categoricals is particularly efficient (though the conversion cost can be higher than the time simply to drop, but if its already categorized then its cheap).

@mrocklin
Copy link
Contributor

I was dropping integers and categoricals. Does this benefit increase beyond two cores?

@jreback
Copy link
Contributor Author

jreback commented Aug 28, 2015

In [10]: N = 10000000

In [11]: df = DataFrame({'A' : np.random.randint(0,1000,size=N)})

In [12]: def f():
   ....:     for i in range(8):
   ....:         df.drop_duplicates()
   ....:         

In [13]: @test_parallel(8)
   ....: def g():
   ....:     df.drop_duplicates()
   ....:     

In [14]: %timeit f()
1 loops, best of 3: 2.49 s per loop

In [15]: %timeit g()
1 loops, best of 3: 1.02 s per loop

@jreback
Copy link
Contributor Author

jreback commented Aug 28, 2015

#10917

will make this:

In [5]: %timeit f()
1 loops, best of 3: 1.6 s per loop

In [6]: %timeit g()
1 loops, best of 3: 595 ms per loop

@jbrockmendel
Copy link
Member

This has likely been pushed as far as it’ll go.

@jreback
Copy link
Contributor Author

jreback commented Oct 29, 2018

can u update the metrics just to see

@jbrockmendel
Copy link
Member

@mroeschke is there any room to release the gil more in window.pyx?

@mroeschke
Copy link
Member

We're pretty liberally using with nogil in a lot of the window routines (cursory check).

@rhshadrach rhshadrach added the Closing Candidate May be closeable, needs more eyeballs label Apr 16, 2021
@mroeschke
Copy link
Member

Probably better if we make separate issues where we can identify targeted areas to release the GIL; going to close for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closing Candidate May be closeable, needs more eyeballs Performance Memory or execution speed performance
Projects
None yet
Development

No branches or pull requests

5 participants