• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

eriknw / toolz / 87
100%
master: 100%

Build:
Build:
LAST BUILD BRANCH: python3.6
DEFAULT BRANCH: master
Ran 10 May 2014 01:33PM UTC
Jobs 4
Files 11
Run time 32s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
87

push

travis-ci

eriknw
Faster groupby!

Issue #178 impressed upon me just how costly attribute resolution can
be.  In this case, `groupby` was made faster by avoiding resolving the
attribute `list.append`.

This implementation is also more memory efficient than the current
version that uses a `defaultdict` that gets cast to a `dict`.  While
casting a defaultdict `d` to a dict as `dict(d)` is fast, it is still
a fast *copy*.

Honorable mention goes to the following implementation:
```python
def groupby_alt(func, seq):
    d = collections.defaultdict(lambda: [].append)
    for item in seq:
        d[func(item)](item)
    rv = {}
    for k, v in iteritems(d):
        rv[k] = v.__self__
    return rv
```
This alternative implementation can at times be *very* impressive.  You
should play with it!

460 of 460 relevant lines covered (100.0%)

4.0 hits per line

Jobs
ID Job ID Ran Files Coverage
1 87.1 (PEP8_IGNORE="") 10 May 2014 01:33PM UTC 0
100.0
Travis Job 87.1
2 87.2 (PEP8_IGNORE="") 10 May 2014 01:33PM UTC 0
100.0
Travis Job 87.2
3 87.3 (PEP8_IGNORE="") 10 May 2014 01:33PM UTC 0
100.0
Travis Job 87.3
4 87.4 (PEP8_IGNORE="") 10 May 2014 01:33PM UTC 0
100.0
Travis Job 87.4
Source Files on build 87
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #87
  • 623c4482 on github
  • Next Build on faster_groupby (#88)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc