tag:blogger.com,1999:blog-1994130783874175266.post1636490414986157000..comments2024-03-28T15:09:12.606+01:00Comments on bitsquid: development blog: Static Hash ValuesNiklashttp://www.blogger.com/profile/10055379994557504977noreply@blogger.comBlogger19125tag:blogger.com,1999:blog-1994130783874175266.post-28165582140254577512022-04-19T13:27:58.771+02:002022-04-19T13:27:58.771+02:00slot joker
สล็อตออนไลน์ ที่เป็นเกมออนไลน์ยอดฮิต อ...<a href="https://slotjoker-spd.com" rel="nofollow">slot joker</a><br /> สล็อตออนไลน์ ที่เป็นเกมออนไลน์ยอดฮิต อยู่ตอนนี้ และ พันธุ์ทิพย์ เป็นแหล่งข้อมูลที่ คนถามถึง เว็บสล็อต slotjoker นั้นมีสูตรลับสำหรับ เล่นสล็อตแตกบ่อย และ โดยปกติผู้ดูแลเว็บไซต์ จะลบมันออก ทำให้หาข้อมูลเกี่ยวกับ สล็อตค่ายไหนดี pantip ค่อนข้างยาก แต่ก็ไม่ได้ยากขนาดนั้น เราพร้อมแนะนำ ผู้เดิมพันเสมอ ผู้เดิมพันส่วนใหญ่ มักจะมองหาข้อมูล เกี่ยวกับสล็อตออนไลน์ เช่น ปั่นสล็อตค่ายไหนดี <a href="https://slotjoker-spd.com" rel="nofollow">slotjoker-spd</a><br />มั่นคง และ ปลอดภัย ซึ่งสล็อตนั้นดี โบนัสมักจะใช้ไม่ได้ หรือแคมป์สล็อตนั้นแตกง่าย สิ่งนี้สามารถเพิ่มโอกาส ในการได้รับรายได้ ผู้เล่นบ่อยขึ้น แต่อย่างไรก็ตาม จุดเด่นสล็อตออนไลน์ คือการออกโบนัสจำนวนมาก รางวัลใหญ่ถูกจับฉลาก โดยเฉพาะถ้าคุณรู้วิธีเล่นสล็อต <br />GAMEhttps://www.blogger.com/profile/03723828924130699843noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-2904485178859186222021-08-17T14:09:45.013+02:002021-08-17T14:09:45.013+02:00The article I saw was interesting because of the i...The article I saw was interesting because of the introduction. As I was looking forward to seeing the count of upcoming posts, showing your plan to continue sharing such great stuff, I'm glad to see you. Visit my latest post on How to Get Better at Using a Mouse. It will be a pleasure to visit <a href="https://mouse-tricks.blogspot.com/2021/08/How-to-Get-Better-at-Using-Mouse-Computer-Mouse-Tips.html" rel="nofollow">Computer Mouse Tips</a>. Thanks for your concern.<br />Maryhttps://www.blogger.com/profile/14644202156317832712noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-30738853139272991812014-11-13T13:36:36.069+01:002014-11-13T13:36:36.069+01:00Hi, could you include a licence to the two google ...Hi, could you include a licence to the two google doc links?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-71702996150845525012014-09-25T17:10:11.354+02:002014-09-25T17:10:11.354+02:00I made a constexpr version:
https://gist.github.c...I made a constexpr version:<br /><br />https://gist.github.com/mattyclarkson/5318077Anonymoushttps://www.blogger.com/profile/10805318183415510295noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-35134253885604837152010-11-27T01:56:11.642+01:002010-11-27T01:56:11.642+01:00Does anyone know the state of support for the &quo...Does anyone know the state of support for the "constexpr" (in C++0x) in current (e.g VS2010) compilers? And user-defined literals, for that matter. Those strike me as something that might help in cases such as this.<br /><br />I used to do stuff like this with template meta-programming, but found out (on some larger projects) you'd get some horrible compile times and run into many compiler limits (compiler heap, recursion depth, etc.) and eventually abandoned the whole thing. Now I just use a combination of calculate-by-hand-and-assert-at-runtime, and just-calculate-at-runtime-and-avoid-the-headache methods!<br /><br />Very instructive blog by the way, specially for someone like me with little experience.yzthttps://www.blogger.com/profile/14935067707298944483noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-14568174618659096862010-10-13T23:17:24.093+02:002010-10-13T23:17:24.093+02:00Agreed, though It looks like Humus approaches it b...Agreed, though It looks like Humus approaches it by manually and explicitly overloading functions, while the templated version takes care of that in the implementation that I've mocked up :)<br /><br />@ignacio. Yeah the templates just massage it into a form that minimizes coder work by not defining all the different flavors of hashes corresponding to string lengths manually.<br /><br />FYI, if you use the inline_depth pragma in MSVC with __forceinline, you can push the threshold out a lot. With these, VS2008 is folding the strings up to 108 characters (probably more, but I didn't test further). I just __forceinlined the templated versions and surround the templated function definitions by<br />#pragma inline_depth(255)<br />.. and:<br />#pragma inline_depth() // restore default<br /><br />But wow, it takes an age to compile this module - on the order of 30 seconds when evaluating a series of 108 hashes on strings of length 1,2,3,..108 in length. This definitely supports the template compile-time = problem argument, but may or may not be workable within your projects scope and may well not be a problem if you structure your code to minimize changes to the module these hashes are included in.<br /><br />Also, with this in mind, I double checked, and a non-templated recursive version of the function (that uses branches to determine how to call itself recursively) doesn't fold beyond 4 character strings - even with __forceinline and #pragma inline_depth.Justin Paverhttps://www.blogger.com/profile/15741775734373907626noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-32029175892566694742010-10-12T01:24:27.194+02:002010-10-12T01:24:27.194+02:00@Justin Oh, that's just what Humus does then:
...@Justin Oh, that's just what Humus does then:<br /><br />http://www.humus.name/index.php?page=News&ID=296<br /><br />As I think you noticed, you are not really using templates for compile time evaluation, you are just relying on the optimizer to fold the constant expressions. Note that the compiler will only do that up to certain string length. After 23 characters or so it will start invoking the function at runtime. You can increase that threshold a bit using forceinline, though.castanohttps://www.blogger.com/profile/08088335278984724562noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-34307735658524459982010-10-07T19:59:41.940+02:002010-10-07T19:59:41.940+02:00Johan: It's an option, but I'm not too fon...Johan: It's an option, but I'm not too fond of static initializers, in fact in the Bitsquid engine we avoid them completely. The reason is not only the static initialization order fiasco, but also the fact that they are tricky to instrument and profile, when you are in the business of minimizing your startup times.Niklashttps://www.blogger.com/profile/10055379994557504977noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-90461091901067913932010-10-07T17:10:29.503+02:002010-10-07T17:10:29.503+02:00I've uploaded another one, and it's fully ...I've uploaded another one, and it's fully public now so should be accessible:<br /><br />https://docs.google.com/leaf?id=0B9ZOSR6WRNMmNDI4MjBkYjYtYTY2Ny00MjAwLWE3YTMtMTUwZTFlOWNmZTk1<br /><br />FWIW, I'm actually seeing VS2005 compile static_murmurhash *and* dynamic_murmurhash down to an immediate if used with a string literal in release builds. The static version is therefore unlikely to be used due to the downsides when it is accidentally used with a non-literal string.Justin Paverhttps://www.blogger.com/profile/15741775734373907626noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-19333373186513007352010-10-07T05:27:40.485+02:002010-10-07T05:27:40.485+02:00This comment has been removed by the author.Justin Paverhttps://www.blogger.com/profile/15741775734373907626noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-84433621342185831222010-10-06T13:18:35.206+02:002010-10-06T13:18:35.206+02:00Can't access the google docs link either :/ I ...Can't access the google docs link either :/ I know this can be implemented properly using C++0x string literals tho.<br /><br />You could also run the hasing during the variable during static initialization. <br /><br />int root_point_id = murmurhash("rootpoint");<br /><br />void foo() { <br /> if (object.name() == root_point_id)<br /> ...<br />}<br /><br />You still pay a runtime penalty of course but do not have to pay for the runtime branch check to see if a function level static variable is initialized. And you also avoid mismatches between runtime/static hashing algorithms.Unknownhttps://www.blogger.com/profile/13416352073776795843noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-2277307347128240352010-10-06T12:58:27.283+02:002010-10-06T12:58:27.283+02:00Nice! Then everyone can just pick and choose the s...Nice! Then everyone can just pick and choose the solution they found best.<br /><br />But that Google Docs link doesn't work for me. I get:<br /><br />"Sorry, the page (or document) you have requested is not available."Niklashttps://www.blogger.com/profile/10055379994557504977noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-22758691225177095372010-10-04T19:20:08.294+02:002010-10-04T19:20:08.294+02:00Using sizeof() on a string literal gives you the l...Using sizeof() on a string literal gives you the length of the string+1 for the zero terminator. I believe it's also compile-time constant for all compilers (unlike strlen). <br /><br />Ignoring compile time issues with templates, I mocked up this templated version of murmurhash just for the exercise:<br /><br />https://docs.google.com/leaf?id=0B9ZOSR6WRNMmZjU2OWE5MmUtMjlhNy00MzA4LTg1ZjEtN2Y1NWU5ZmYxNjk2&sort=name&layout=list&num=50<br /><br />Compiling with VS2008 shows static_murmurhash("your_string_literal_here") collapses to a 32-bit immediate, although sadly you still can't use this in a switch statement for the same reasons that MaciejS says. ("hello"[0] not considered constant in the case statement)<br /><br />caveat emptor: do not accidentally use static_murmurhash with a non-literal string. It'll only hash the first 3 bytes of the string. I'm sure you'll figure out why :)Justin Paverhttps://www.blogger.com/profile/15741775734373907626noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-80128912572406384812010-10-01T19:47:15.579+02:002010-10-01T19:47:15.579+02:00Indeed. Your static_hash function is essentially ...Indeed. Your static_hash function is essentially the same as our H(). Both are easily processed or verified by an external program.Phil Teschnerhttps://www.blogger.com/profile/07688687352136934369noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-20155813401370454252010-10-01T17:27:47.628+02:002010-10-01T17:27:47.628+02:00Phil: I expect mismatches to be rare and to also c...Phil: I expect mismatches to be rare and to also crash the release build (with a not-as-nice error message). So I'm not so worried about mismatches. The debug check is more of a belt-and-suspenders thing.<br /><br />It is also nice to have all hashes tagged with the static_hash() because it makes them easy to find, if that is needed for some reason.<br /><br />(I could run a pre-parser script on the code, looking for static_hash() and thus get the behavior you are talking about.)<br /><br />With templates I worry both about compile times and whether all different compilers will actually compile the code down to a single int. That's why I went with a preprocessor solution instead. (Though compile times may be an issue there as well.)Niklashttps://www.blogger.com/profile/10055379994557504977noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-84484250334544544712010-10-01T17:15:23.396+02:002010-10-01T17:15:23.396+02:00I've worked with few various systems for that ...I've worked with few various systems for that in the past, one I liked the most was pre-parser (almost identical to the one Phil mentioned).<br />Problem with template meta-programming is that usually result is still not a true compile-time constant (even if there is no runtime calculations involved), so it cannot be used in switch/case construct for example. (Mainly because "hello"[0] is not compile time).MaciejShttps://www.blogger.com/profile/15783093211220278613noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-13195260944727602132010-10-01T15:13:21.521+02:002010-10-01T15:13:21.521+02:00We went with pre-parsing somewhere along the lines...We went with pre-parsing somewhere along the lines of what Julien mentioned. Instead of storing the output in a separate file we just modify the source file in place.<br /><br />What we do is to place every string in a macro like this:<br /><br />H("hello", 0)<br /><br />Which gets replaced with the appropriate hash in the second parameter. So immediately after the pre-parser has run on the code file it would look like this:<br /><br />H("hello", 0x263262)<br /><br />The nice thing is that you only ever need to run the parser on a file that has been modified. The bad thing is that it depends on how well your build system supports modifying a file during a build.<br /><br />An alternative would have been to make people manually run the parser and then just have a validation process in our continuous integration server that checks all the macros to make sure the numbers are correct.<br /><br />I dislike relying on a debug build to find mismatches because it assumes that you'll get full code coverage when you are running the build and that is very hard to achieve.<br /><br />An alternative I have played with is to use template meta-programming to compute the hash. It works but relies on the compiler to remove all unused code which I also don't like to rely on. Something along the lines of what Humus mentions on his blog (http://www.humus.name/index.php?page=News&ID=296)Phil Teschnerhttps://www.blogger.com/profile/07688687352136934369noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-70414224969460003232010-10-01T14:56:12.494+02:002010-10-01T14:56:12.494+02:00Perhaps you could still put the values themselves ...Perhaps you could still put the values themselves into a single file as a define.. at least then the values are in one place, which is useful just in case the hash generation code is changed.Sander van Rossenhttps://www.blogger.com/profile/13955123864686957569noreply@blogger.comtag:blogger.com,1999:blog-1994130783874175266.post-6475424018992669992010-10-01T14:45:08.214+02:002010-10-01T14:45:08.214+02:00What we do here at keen games is that we have .crc...What we do here at keen games is that we have .crc files (text files with one identifier in each line) that run through a ruby script in our maketool (before the compilation starts). This script creates a header file with defines for each symbol in the crc file and the hash (crc32 in our case) value as value. That worked like a charm for all our projects.<br /><br />Regards<br />JulienJulien Koenenhttps://www.blogger.com/profile/00644404202920811734noreply@blogger.com