Java 中的顺序指南
考虑到我发表的有关 Microsoft.NET 框架上的顺序 guid 性能的文章(请参阅 Sequential Guid 相对于标准 Guid 的性能改进是什么?)是否有人对在Windows DLL?
问候 马西莫
Considering the post I've made about the sequential guid performance on Microsoft.NET framework (see What are the performance improvement of Sequential Guid over standard Guid?) does somebody have a proper, sure, fast and well working Java implementation of the same algorithm implemented in the Windows DLLs?
Regards
Massimo
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
请参阅这篇文章:http://www.informit.com/articles /article.aspx?p=25862&seqNum=7(链接到第 7 页)。
它包含作者称为“COMB”指南的算法;我在下面复制了他的代码 (SQL):
将其转换为 Java 或您想要的语言很简单。明显的基本原则是使日期成为指南的组成部分。整篇文章读起来很好,因为他对各种方法的性能进行了很好的分析。
See this article: http://www.informit.com/articles/article.aspx?p=25862&seqNum=7 (linked to Page 7).
It contains an algorithm for what the author refers to as "COMB" Guids; I reproduce his code (SQL) below:
Trivial to convert this to Java, or your desired language. The obvious underlying principle is to make the date a component of the Guid. The entire article is a good read, as he does a nice analysis of the performance of the various approaches.
对于顺序 UUID,您正在寻找版本 1 UUID。 Java UUID Generator 项目似乎运行良好并且非常易于使用:
For sequential UUIDs, you are looking for a version 1 UUID. Java UUID Generator project seems to work quite well and is pretty easy to use:
此页面链接到 Java 中的几个版本 1(顺序)UUID 实现:
http://johannburkard.de/blog/programming/java/Java -UUID-generators-compared.html
This page links to a couple of version 1 (sequential) UUID implementations in Java:
http://johannburkard.de/blog/programming/java/Java-UUID-generators-compared.html
这个生成 COMB UUID 的实用程序类,由 Jimmy Nilsson 在本文中构思: http: //www.informit.com/articles/article.aspx?p=25862。欢迎使用和分享。
这是输出:
您还可以使用
uuid-creator
库。请参阅以下示例:项目页面:https://github.com/f4b6a3/uuid-creator
This utility class that generates COMB UUIDs, conceived by Jimmy Nilsson in this article: http://www.informit.com/articles/article.aspx?p=25862. Feel free to use and share.
This is the output:
You can also use the
uuid-creator
library. See these examples:Project page: https://github.com/f4b6a3/uuid-creator
我使用它为我的 DTO 生成 UUID(通用唯一 ID),它充当临时集合的代理键。不知道这是否是同一件事,但它可能会为您指明正确的方向。
I use this to generate UUIDs (Universally Unique IDs) for my DTOs which act as surrogate keys for transient collections. Don't know if it's the same thing, but it may point you in the right direction.