perf: optimize user-list, xauth, and xdmcp paths - #478
Open
GermanAizek wants to merge 1 commit into
Open
Conversation
1. User List Optimization:
- Replace O(N^2) per-entry g_list_insert_sorted() during passwd loading
with O(1) prepend and a single O(N log N) g_list_sort() merge sort
- Replace O(N^2) nested list traversals for existing and removed users
with O(1) hash tables
2. Xauthority File Operations:
- Buffer all serialized records into a GByteArray in memory before
writing to disk in a single atomic write() syscall, replacing up to
350 separate syscalls per update
- Replace byte-by-byte loops in read_data() with block memcpy()
- Replace O(N^2) g_list_append() with O(N) prepend + reverse
3. XDMCP Protocol Serialization:
- Replace byte-by-byte loops in read_data(), read_string(), write_data(),
and write_string() with single-check block memcpy() operations
Collaborator
|
So the thing with the user lists.. I imagine most systems don't more than like, eight users at most? So I'm not sure how much this helps. Unless there are people using LightDM on systems with tons of users (in which this would be good) I'm definitely interested in Xauthority and XDMCP optimizations. I haven't decided what balance between space and time complexity we should have.. |
Contributor
Author
This is easy to calculate as a proportion. 371x - 1000 users lookup It’s actually more logical to use a hashtable. |
Collaborator
|
By that calculation.. for a one user system that's a slowdown (0.37) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@jpeisach,
Using perf benchmarks from this PR (#477), we were able to carry out useful algorithmic optimization, namely:
User List
Xauthority
XDMCP
I post visual graphs my benchmarks on NUMA server motherboard 2x Xeon E5-2699v3 (Haswell 2014 year - 36 core 72 threads)
Two commits were compared:
Attention on lookup_by_name from user list, change math algorithm speedup in 371x times !!!