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

Embed pair_list_t structure into MultiDict Python object #395

Merged
merged 2 commits into from Nov 22, 2019

Conversation

asvetlov
Copy link
Member

@asvetlov asvetlov commented Nov 22, 2019

It removes one indirection level.
No need for extra memalloc, plus multidict with embedded pair-list fits CPU cache a little better.

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Nov 22, 2019
@codecov
Copy link

codecov bot commented Nov 22, 2019

Codecov Report

Merging #395 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #395   +/-   ##
======================================
  Coverage    75.1%   75.1%           
======================================
  Files           5       5           
  Lines         470     470           
======================================
  Hits          353     353           
  Misses        117     117

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20e15f8...34e472a. Read the comment docs.

uint64_t version; // 8
calc_identity_func calc_identity; // 8
pair_t *pairs; // 8
} pair_list_t;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will be nice to refactoring this name. Sufix "_t" is not so good because of POSIX use it for type definitions. Mb something like this MultiDictVec and MultiDictVecItem? But if rename structs it will be good to rename and functions too, for example, rename pair_list_* to multidict_vec_*, what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the interesting question.
I've found that the separation of multidict PyObject class and pair_list_t plain C structure makes sense, at least for the current code stage.
Thinking more, pair list doesn't exist alone. It is a part of MultiDict or CIMultiDict struct. Maybe later we come up to idea of joining not only pair_list_t and MultiDict object structures but APIs also? In this case, the pair-list will go.

The pair list was crucial for the transition from Cython to pure C, I'm not sure if it still is needed.
Let's shake the code and see. If the list should stay I completely agree with MultiDictVec / MultiDictVecItem proposal. Let's decide later

Copy link
Contributor

@iemelyanov iemelyanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@asvetlov asvetlov merged commit fc9c633 into master Nov 22, 2019
@asvetlov asvetlov deleted the embed-pair-list branch November 22, 2019 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants