Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Implement "event_fields" in filters #1638
Conversation
Kegsay
added some commits
Nov 21, 2016
Kegsay
assigned
erikjohnston
Nov 22, 2016
erikjohnston
reviewed
Nov 22, 2016
You've mentioned performance a couple of times, I wonder if its worth doing a quick benchmark to see how long it takes to serialise events?
| + for sub_field in field: | ||
| + if sub_field not in sub_out_dict: | ||
| + sub_out_dict[sub_field] = {} | ||
| + sub_out_dict = sub_out_dict[sub_field] |
erikjohnston
Nov 22, 2016
Owner
You can replace the 3 lines with:
sub_out_dict = sub_out_dict.setdefault(sub_field, {})| + # for each element of the output array of arrays: | ||
| + # remove escaping so we can use the right key names. This purposefully avoids | ||
| + # using list comprehensions to avoid needless allocations as this may be called | ||
| + # on a lot of events. |
erikjohnston
Nov 22, 2016
Owner
I did a quick benchmark and the following list comprehension is actually quicker:
split_fields[:] = [ [field.replace(r'\.', r'.') for field in field_array] for field_array in split_fields]
erikjohnston
Nov 22, 2016
Owner
And if we really cared about performance, we would pull this up to be calculated when we initially parsed the filter
| + d = event_format(d) | ||
| + | ||
| + if (only_event_fields and isinstance(only_event_fields, list) and | ||
| + all(isinstance(f, basestring) for f in only_event_fields)): |
|
LGTM |
Kegsay
merged commit d4a459f
into
develop
Nov 22, 2016
9 of 10 checks passed
Sytest Dendron (Commit)
Build #1142 origin/kegan/sync-event-fields failed in 2 min 12 sec
Details
Flake8 + Packaging (Commit)
Build #2076 origin/kegan/sync-event-fields succeeded in 55 sec
Details
Flake8 + Packaging (Merged PR)
Build finished.
Details
Sytest Dendron (Merged PR)
Build finished.
Details
Sytest Postgres (Commit)
Build #1979 origin/kegan/sync-event-fields succeeded in 9 min 20 sec
Details
Sytest Postgres (Merged PR)
Build finished.
Details
Sytest SQLite (Commit)
Build #2025 origin/kegan/sync-event-fields succeeded in 6 min 22 sec
Details
Sytest SQLite (Merged PR)
Build finished.
Details
Unit Tests (Commit)
Build #2107 origin/kegan/sync-event-fields succeeded in 3 min 19 sec
Details
Unit Tests (Merged PR)
Build finished.
Details
Kegsay
referenced this pull request
in matrix-org/matrix-appservice-irc
Nov 25, 2016
Closed
Freenode bridge outage (19-21 Nov) #288
richvdh
deleted the
kegan/sync-event-fields
branch
Dec 1, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Kegsay commentedNov 22, 2016
http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-user-userid-filter