<commit_before># [Why is creating a set from a concatenated list faster than using `.update`?](http://stackoverflow.com/q/32483539/4279)

[![build status on travis-ci.org][2]][1]

[1]: https://travis-ci.org/zed/test-performance-create-set-from-3-lists
[2]: https://api.travis-ci.org/zed/test-performance-create-set-from-3-lists.svg?branch=master

To measure time performance of creating a set from 3 lists, run `tox`.<commit_msg>add example results to readme<commit_after># [Why is creating a set from a concatenated list faster than using `.update`?](http://stackoverflow.com/q/32483539/4279)

[![build status on travis-ci.org][2]][1]

[1]: https://travis-ci.org/zed/test-performance-create-set-from-3-lists
[2]: https://api.travis-ci.org/zed/test-performance-create-set-from-3-lists.svg?branch=master

To measure time performance of creating a set from 3 lists, run `tox`.

### [Python 2.7 results](https://travis-ci.org/zed/test-performance-create-set-from-3-lists/jobs/79507962)

    set(A+B+C): 10 loops, best of 3: 643 msec per loop
    set(A).update(B, C): 10 loops, best of 3: 565 msec per loop
    set(itertools.chain(A,B,C)): 10 loops, best of 3: 612 msec per loop

### [Pypy results](https://travis-ci.org/zed/test-performance-create-set-from-3-lists/jobs/79507967)

    set(A+B+C): 10 loops, best of 3: 472 msec per loop
    set(A).update(B, C): 10 loops, best of 3: 572 msec per loop
    set(itertools.chain(A,B,C)): 10 loops, best of 3: 783 msec per loop
{'fraction_non_alphanumeric': 0.1614441416893733, 'fraction_numerical': 0.06403269754768393, 'mean_word_length': 4.227758007117438, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5945666', 'n_tokens_mistral': 605, 'n_tokens_neox': 541, 'n_words': 140}