Skip to content

UUID v7 - Proposal, implementation, and performance enhancements#1836

Draft
parkera wants to merge 15 commits intoswiftlang:mainfrom
parkera:parkera/uuidv7
Draft

UUID v7 - Proposal, implementation, and performance enhancements#1836
parkera wants to merge 15 commits intoswiftlang:mainfrom
parkera:parkera/uuidv7

Conversation

@parkera
Copy link
Copy Markdown
Contributor

@parkera parkera commented Mar 18, 2026

Add a new API proposal for UUID, plus corresponding implementation.

Motivation:

See the proposal for this.

Modifications:

New proposal, new implementation changes to support it, plus associated performance changes.

Result:

Benchmark shows 185% improvement in UUIDCreate, 23% improvement in UUIDString. Also removes the need for C shims for UUID.

Testing:

New unit tests, new benchmarks.

@parkera
Copy link
Copy Markdown
Contributor Author

parkera commented Mar 18, 2026

@swift-ci test

@parkera
Copy link
Copy Markdown
Contributor Author

parkera commented Mar 19, 2026

@swift-ci test

return Duration.seconds(seconds) + Duration(secondsComponent: 0, attosecondsComponent: remainingTicks * 100_000_000_000)
#else
var ts = timespec()
clock_gettime(CLOCK_REALTIME, &ts)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is not monotonic btw:

     CLOCK_REALTIME     the system's real time (i.e. wall time) clock, expressed as the amount of time since the Epoch.  This is the same as the value returned by
                        gettimeofday(2).

that can be adjusted by NTP or by the user adjusting the clock.

@parkera
Copy link
Copy Markdown
Contributor Author

parkera commented Mar 20, 2026

@swift-ci test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants