Blender V4.3
BLI_map_performance_test.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023-2024 Blender Authors
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
6#include "testing/testing.h"
7
8#define GHASH_INTERNAL_API
9
10#include "MEM_guardedalloc.h"
11
12#include "BLI_fileops.h"
13#include "BLI_ghash.h"
14#include "BLI_map.hh"
16#include "BLI_rand.h"
17#include "BLI_string.h"
18#include "BLI_timeit.hh"
19#include "BLI_utildefines.h"
20
21using namespace blender;
22
23/* Using https://downloads.wortschatz-leipzig.de/corpora/eng_wikipedia_2010_1M.tar.gz
24 * (1 million of words, about 122MB of text) from
25 * https://wortschatz.uni-leipzig.de/en/download/English
26 * Otherwise a small `words10k` corpus is used. */
27#if 0
28# define TEXT_CORPUS_PATH "../../../../../eng_wikipedia_2010_1M-sentences.txt"
29#endif
30
31/* Resizing the hash has a huge cost over global filling operation! */
32static constexpr bool USE_RESERVE_COUNT = false;
33
34/* Run the longest tests! */
35// #define USE_BIG_TESTS
36
37/* Size of 'small case' ghash (number of entries). */
38static constexpr size_t TESTCASE_SIZE_SMALL = 17;
39
40static void print_ghash_stats(GHash *gh)
41{
42 double lf, var, pempty, poverloaded;
43 int bigb;
44 double q = BLI_ghash_calc_quality_ex(gh, &lf, &var, &pempty, &poverloaded, &bigb);
45 printf(
46 "GHash stats (%u entries):\n\t"
47 "Quality (the lower the better): %f\n\tVariance (the lower the better): %f\n\tLoad: "
48 "%f\n\t"
49 "Empty buckets: %.2f%%\n\tOverloaded buckets: %.2f%% (biggest bucket: %d)\n",
50 BLI_ghash_len(gh),
51 q,
52 var,
53 lf,
54 pempty * 100.0,
55 poverloaded * 100.0,
56 bigb);
57}
58
59/* Str: whole text, lines and words from a 'corpus' text. */
60
61static char *read_text_corpus()
62{
63 char *data = nullptr;
64
65#ifdef TEXT_CORPUS_PATH
66 size_t data_size;
67 data = static_cast<char *>(BLI_file_read_text_as_mem(TEXT_CORPUS_PATH, 1, &data_size));
68 if (data != nullptr) {
69 data[data_size] = 0;
70 }
71#endif
72
73 if (data == nullptr) {
74 data = BLI_strdup(words10k);
75 }
76 return data;
77}
78
79static void str_ghash_tests(GHash *ghash, const char *id)
80{
81 printf("\n========== STARTING %s ==========\n", id);
82
83 char *data = read_text_corpus();
84 char *data_p = BLI_strdup(data);
85 char *data_w = BLI_strdup(data);
86 char *data_bis = BLI_strdup(data);
87
88 {
89 SCOPED_TIMER("string_insert");
90
92 BLI_ghash_reserve(ghash, strlen(data) / 32); /* rough estimation... */
93 }
94
95 BLI_ghash_insert(ghash, data, POINTER_FROM_INT(data[0]));
96
97 char *p, *w, *c_p, *c_w;
98 for (p = c_p = data_p, w = c_w = data_w; *c_w; c_w++, c_p++) {
99 if (*c_p == '.') {
100 *c_p = *c_w = '\0';
101 if (!BLI_ghash_haskey(ghash, p)) {
102 BLI_ghash_insert(ghash, p, POINTER_FROM_INT(p[0]));
103 }
104 if (!BLI_ghash_haskey(ghash, w)) {
106 }
107 p = c_p + 1;
108 w = c_w + 1;
109 }
110 else if (*c_w == ' ') {
111 *c_w = '\0';
112 if (!BLI_ghash_haskey(ghash, w)) {
114 }
115 w = c_w + 1;
116 }
117 }
118 }
119
120 print_ghash_stats(ghash);
121
122 {
123 SCOPED_TIMER("string_lookup");
124
125 void *v = BLI_ghash_lookup(ghash, data_bis);
126 EXPECT_EQ(POINTER_AS_INT(v), data_bis[0]);
127
128 char *p, *w, *c;
129 for (p = w = c = data_bis; *c; c++) {
130 if (*c == '.') {
131 *c = '\0';
132 v = BLI_ghash_lookup(ghash, w);
134 v = BLI_ghash_lookup(ghash, p);
135 EXPECT_EQ(POINTER_AS_INT(v), p[0]);
136 p = w = c + 1;
137 }
138 else if (*c == ' ') {
139 *c = '\0';
140 v = BLI_ghash_lookup(ghash, w);
142 w = c + 1;
143 }
144 }
145 }
146
147 BLI_ghash_free(ghash, nullptr, nullptr);
148 MEM_freeN(data);
149 MEM_freeN(data_p);
150 MEM_freeN(data_w);
151 MEM_freeN(data_bis);
152
153 printf("========== ENDED %s ==========\n\n", id);
154}
155
156template<typename MapType> static void str_map_tests(MapType &map, const char *id)
157{
158 printf("\n========== STARTING %s ==========\n", id);
159
160 char *data = read_text_corpus();
161 char *data_p = BLI_strdup(data);
162 char *data_w = BLI_strdup(data);
163 char *data_bis = BLI_strdup(data);
164
165 {
166 SCOPED_TIMER("string_insert");
167
168 if (USE_RESERVE_COUNT) {
169 map.reserve(strlen(data) / 32); /* rough estimation... */
170 }
171
172 map.add_new(StringRef(data), data[0]);
173
174 char *p, *w, *c_p, *c_w;
175 for (p = c_p = data_p, w = c_w = data_w; *c_w; c_w++, c_p++) {
176 if (*c_p == '.') {
177 *c_p = *c_w = '\0';
178 map.add(StringRef(p), p[0]);
179 map.add(StringRef(w), w[0]);
180 p = c_p + 1;
181 w = c_w + 1;
182 }
183 else if (*c_w == ' ') {
184 *c_w = '\0';
185 map.add(StringRef(w), w[0]);
186 w = c_w + 1;
187 }
188 }
189 }
190
191 map.print_stats("map");
192
193 {
194 SCOPED_TIMER("string_lookup");
195
196 int v = map.lookup(StringRef(data_bis));
197 EXPECT_EQ(v, data_bis[0]);
198
199 char *p, *w, *c;
200 for (p = w = c = data_bis; *c; c++) {
201 if (*c == '.') {
202 *c = '\0';
203 v = map.lookup(StringRef(w));
204 EXPECT_EQ(v, w[0]);
205 v = map.lookup(StringRef(p));
206 EXPECT_EQ(v, p[0]);
207 p = w = c + 1;
208 }
209 else if (*c == ' ') {
210 *c = '\0';
211 v = map.lookup(StringRef(w));
212 EXPECT_EQ(v, w[0]);
213 w = c + 1;
214 }
215 }
216 }
217
218 MEM_freeN(data);
219 MEM_freeN(data_p);
220 MEM_freeN(data_w);
221 MEM_freeN(data_bis);
222
223 printf("========== ENDED %s ==========\n\n", id);
224}
225
226TEST(ghash, TextGHash)
227{
229
230 str_ghash_tests(ghash, "StrGHash - GHash");
231}
232
233TEST(ghash, TextMurmur2a)
234{
236
237 str_ghash_tests(ghash, "StrGHash - Murmur");
238}
239
240TEST(ghash, TextMap)
241{
243 str_map_tests(map, "StrMap - DefaultHash");
244}
245
246/* Int: uniform 100M first integers. */
247
248static void int_ghash_tests(GHash *ghash, const char *id, const uint count)
249{
250 printf("\n========== STARTING %s ==========\n", id);
251
252 {
253 SCOPED_TIMER("int_insert");
254 uint i = count;
255
256 if (USE_RESERVE_COUNT) {
257 BLI_ghash_reserve(ghash, count);
258 }
259
260 while (i--) {
262 }
263 }
264
265 print_ghash_stats(ghash);
266
267 {
268 SCOPED_TIMER("int_lookup");
269 uint i = count;
270
271 while (i--) {
272 void *v = BLI_ghash_lookup(ghash, POINTER_FROM_UINT(i));
274 }
275 }
276
277 {
278 SCOPED_TIMER("int_pop");
279 GHashIterState pop_state = {0};
280
281 void *k, *v;
282 while (BLI_ghash_pop(ghash, &pop_state, &k, &v)) {
283 EXPECT_EQ(k, v);
284 }
285 }
286 EXPECT_EQ(BLI_ghash_len(ghash), 0);
287
288 BLI_ghash_free(ghash, nullptr, nullptr);
289
290 printf("========== ENDED %s ==========\n\n", id);
291}
292
293template<typename MapType>
294static void int_map_tests(MapType &map, const char *id, const uint count)
295{
296 printf("\n========== STARTING %s ==========\n", id);
297
298 {
299 SCOPED_TIMER("int_insert");
300 uint i = count;
301
302 if (USE_RESERVE_COUNT) {
303 map.reserve(count);
304 }
305
306 while (i--) {
307 map.add_new(i, i);
308 }
309 }
310
311 map.print_stats("map");
312
313 {
314 SCOPED_TIMER("int_lookup");
315 uint i = count;
316 while (i--) {
317 int v = map.lookup(i);
318 EXPECT_EQ(v, i);
319 }
320 }
321
322 {
323 SCOPED_TIMER("int_pop");
324 uint i = count;
325 while (i--) {
326 int v = map.pop(i);
327 EXPECT_EQ(v, i);
328 }
329 }
330 EXPECT_EQ(map.size(), 0);
331
332 printf("========== ENDED %s ==========\n\n", id);
333}
334
335TEST(ghash, IntGHash12000)
336{
338
339 int_ghash_tests(ghash, "IntGHash - GHash - 12000", 12000);
340}
341
342#ifdef USE_BIG_TESTS
343TEST(ghash, IntGHash100000000)
344{
346
347 int_ghash_tests(ghash, "IntGHash - GHash - 100000000", 100000000);
348}
349#endif
350
351TEST(ghash, IntMurmur2a12000)
352{
354
355 int_ghash_tests(ghash, "IntGHash - Murmur - 12000", 12000);
356}
357
358#ifdef USE_BIG_TESTS
359TEST(ghash, IntMurmur2a100000000)
360{
362
363 int_ghash_tests(ghash, "IntGHash - Murmur - 100000000", 100000000);
364}
365#endif
366
367TEST(ghash, IntMap12000)
368{
369 Map<int, int> map;
370 int_map_tests(map, "IntMap - DefaultHash - 12000", 12000);
371}
372
373#ifdef USE_BIG_TESTS
374TEST(ghash, IntMap100000000)
375{
376 Map<int, int> map;
377 int_map_tests(map, "IntMap - DefaultHash - 100000000", 100000000);
378}
379#endif
380
381/* Int: random 50M integers. */
382
383static void randint_ghash_tests(GHash *ghash, const char *id, const uint count)
384{
385 printf("\n========== STARTING %s ==========\n", id);
386
388 {
389 RNG *rng = BLI_rng_new(1);
390 for (uint i = 0; i < count; i++) {
391 data[i] = BLI_rng_get_uint(rng);
392 }
393 BLI_rng_free(rng);
394 }
395
396 {
397 SCOPED_TIMER("int_insert");
398 if (USE_RESERVE_COUNT) {
399 BLI_ghash_reserve(ghash, count);
400 }
401 for (uint i = 0; i < count; i++) {
402 uint dt = data[i];
404 }
405 }
406
407 print_ghash_stats(ghash);
408
409 {
410 SCOPED_TIMER("int_lookup");
411 for (uint i = 0; i < count; i++) {
412 uint dt = data[i];
413 void *v = BLI_ghash_lookup(ghash, POINTER_FROM_UINT(dt));
415 }
416 }
417
418 BLI_ghash_free(ghash, nullptr, nullptr);
419
420 printf("========== ENDED %s ==========\n\n", id);
421}
422
423template<typename MapType>
424static void randint_map_tests(MapType &map, const char *id, const uint count)
425{
426 printf("\n========== STARTING %s ==========\n", id);
427
429 {
430 RNG *rng = BLI_rng_new(1);
431 for (uint i = 0; i < count; i++) {
432 data[i] = BLI_rng_get_uint(rng);
433 }
434 BLI_rng_free(rng);
435 }
436
437 {
438 SCOPED_TIMER("int_insert");
439 if (USE_RESERVE_COUNT) {
440 map.reserve(count);
441 }
442 for (uint i = 0; i < count; i++) {
443 uint dt = data[i];
444 map.add_new(dt, dt);
445 }
446 }
447
448 map.print_stats("map");
449
450 {
451 SCOPED_TIMER("int_lookup");
452 for (uint i = 0; i < count; i++) {
453 uint dt = data[i];
454 int v = map.lookup(dt);
455 EXPECT_EQ(v, dt);
456 }
457 }
458
459 printf("========== ENDED %s ==========\n\n", id);
460}
461
462TEST(ghash, IntRandGHash12000)
463{
465
466 randint_ghash_tests(ghash, "RandIntGHash - GHash - 12000", 12000);
467}
468
469#ifdef USE_BIG_TESTS
470TEST(ghash, IntRandGHash50000000)
471{
473
474 randint_ghash_tests(ghash, "RandIntGHash - GHash - 50000000", 50000000);
475}
476#endif
477
478TEST(ghash, IntRandMurmur2a12000)
479{
481
482 randint_ghash_tests(ghash, "RandIntGHash - Murmur - 12000", 12000);
483}
484
485#ifdef USE_BIG_TESTS
486TEST(ghash, IntRandMurmur2a50000000)
487{
489
490 randint_ghash_tests(ghash, "RandIntGHash - Murmur - 50000000", 50000000);
491}
492#endif
493
494TEST(ghash, IntRandMap12000)
495{
496 Map<int, int> map;
497 randint_map_tests(map, "RandIntMap - DefaultHash - 12000", 12000);
498}
499
500#ifdef USE_BIG_TESTS
501TEST(ghash, IntRandMap50000000)
502{
503 Map<int, int> map;
504 randint_map_tests(map, "RandIntMap - DefaultHash - 50000000", 50000000);
505}
506#endif
507
508static uint ghashutil_tests_nohash_p(const void *p)
509{
510 return POINTER_AS_UINT(p);
511}
512
513static bool ghashutil_tests_cmp_p(const void *a, const void *b)
514{
515 return a != b;
516}
517
518TEST(ghash, IntRandNoHash12000)
519{
521
522 randint_ghash_tests(ghash, "RandIntGHash - No Hash - 12000", 12000);
523}
524
525#ifdef USE_BIG_TESTS
526TEST(ghash, IntRandNoHash50000000)
527{
529
530 randint_ghash_tests(ghash, "RandIntGHash - No Hash - 50000000", 50000000);
531}
532#endif
533
534/* Int_v4: 20M of randomly-generated integer vectors. */
535
536static void int4_ghash_tests(GHash *ghash, const char *id, const uint count)
537{
538 printf("\n========== STARTING %s ==========\n", id);
539
541
542 {
543 RNG *rng = BLI_rng_new(1);
544 for (uint i = 0; i < count; i++) {
545 uint4 v;
546 for (int j = 0; j < 4; j++) {
547 v[j] = BLI_rng_get_uint(rng);
548 }
549 data[i] = v;
550 }
551 BLI_rng_free(rng);
552 }
553
554 {
555 SCOPED_TIMER("int_v4_insert");
556 if (USE_RESERVE_COUNT) {
557 BLI_ghash_reserve(ghash, count);
558 }
559 for (uint i = 0; i < count; i++) {
560 BLI_ghash_insert(ghash, &data[i], POINTER_FROM_UINT(i));
561 }
562 }
563
564 print_ghash_stats(ghash);
565
566 {
567 SCOPED_TIMER("int_v4_lookup");
568 for (uint i = 0; i < count; i++) {
569 void *v = BLI_ghash_lookup(ghash, &data[i]);
571 }
572 }
573
574 BLI_ghash_free(ghash, nullptr, nullptr);
575
576 printf("========== ENDED %s ==========\n\n", id);
577}
578
579template<typename MapType>
580static void int4_map_tests(MapType &map, const char *id, const uint count)
581{
582 printf("\n========== STARTING %s ==========\n", id);
583
585
586 {
587 RNG *rng = BLI_rng_new(1);
588 for (uint i = 0; i < count; i++) {
589 uint4 v;
590 for (int j = 0; j < 4; j++) {
591 v[j] = BLI_rng_get_uint(rng);
592 }
593 data[i] = v;
594 }
595 BLI_rng_free(rng);
596 }
597
598 {
599 SCOPED_TIMER("int_v4_insert");
600 if (USE_RESERVE_COUNT) {
601 map.reserve(count);
602 }
603 for (uint i = 0; i < count; i++) {
604 map.add_new(data[i], i);
605 }
606 }
607
608 map.print_stats("map");
609
610 {
611 SCOPED_TIMER("int_v4_lookup");
612 for (uint i = 0; i < count; i++) {
613 int v = map.lookup(data[i]);
615 }
616 }
617
618 printf("========== ENDED %s ==========\n\n", id);
619}
620
621TEST(ghash, Int4GHash2000)
622{
623 GHash *ghash = BLI_ghash_new(
625
626 int4_ghash_tests(ghash, "Int4GHash - GHash - 2000", 2000);
627}
628
629#ifdef USE_BIG_TESTS
630TEST(ghash, Int4GHash20000000)
631{
632 GHash *ghash = BLI_ghash_new(
634
635 int4_ghash_tests(ghash, "Int4GHash - GHash - 20000000", 20000000);
636}
637#endif
638
639TEST(ghash, Int4Murmur2a2000)
640{
641 GHash *ghash = BLI_ghash_new(
643
644 int4_ghash_tests(ghash, "Int4GHash - Murmur - 2000", 2000);
645}
646
647#ifdef USE_BIG_TESTS
648TEST(ghash, Int4Murmur2a20000000)
649{
650 GHash *ghash = BLI_ghash_new(
652
653 int4_ghash_tests(ghash, "Int4GHash - Murmur - 20000000", 20000000);
654}
655#endif
656
657TEST(ghash, Int4Map2000)
658{
659 Map<uint4, int> map;
660 int4_map_tests(map, "Int4Map - DefaultHash - 2000", 2000);
661}
662
663#ifdef USE_BIG_TESTS
664TEST(ghash, Int4Map20000000)
665{
666 Map<uint4, int> map;
667 int4_map_tests(map, "Int4Map - DefaultHash - 20000000", 20000000);
668}
669#endif
670
671/* MultiSmall: create and manipulate a lot of very small ghash's
672 * (90% < 10 items, 9% < 100 items, 1% < 1000 items). */
673
674static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const uint count)
675{
676 uint *data = (uint *)MEM_mallocN(sizeof(*data) * size_t(count), __func__);
677 uint *dt;
678 uint i;
679
680 for (i = count, dt = data; i--; dt++) {
681 *dt = BLI_rng_get_uint(rng);
682 }
683
684 if (USE_RESERVE_COUNT) {
685 BLI_ghash_reserve(ghash, count);
686 }
687
688 for (i = count, dt = data; i--; dt++) {
690 }
691
692 for (i = count, dt = data; i--; dt++) {
693 void *v = BLI_ghash_lookup(ghash, POINTER_FROM_UINT(*dt));
695 }
696
697 BLI_ghash_clear(ghash, nullptr, nullptr);
698 MEM_freeN(data);
699}
700
701static void multi_small_ghash_tests(GHash *ghash, const char *id, const uint count)
702{
703 printf("\n========== STARTING %s ==========\n", id);
704
705 RNG *rng = BLI_rng_new(1);
706
707 {
708 SCOPED_TIMER("multi_small_ghash");
709 uint i = count;
710 while (i--) {
711 const int count = 1 + (BLI_rng_get_int(rng) % TESTCASE_SIZE_SMALL) *
712 (!(i % 100) ? 100 : (!(i % 10) ? 10 : 1));
714 }
715 }
716 {
717 SCOPED_TIMER("multi_small2_ghash");
718 uint i = count;
719 while (i--) {
720 const int count = 1 + (BLI_rng_get_int(rng) % TESTCASE_SIZE_SMALL) / 2 *
721 (!(i % 100) ? 100 : (!(i % 10) ? 10 : 1));
723 }
724 }
725
726 BLI_ghash_free(ghash, nullptr, nullptr);
727 BLI_rng_free(rng);
728
729 printf("========== ENDED %s ==========\n\n", id);
730}
731
732TEST(ghash, MultiRandIntGHash2000)
733{
735
736 multi_small_ghash_tests(ghash, "MultiSmall RandIntGHash - GHash - 2000", 2000);
737}
738
739TEST(ghash, MultiRandIntGHash200000)
740{
742
743 multi_small_ghash_tests(ghash, "MultiSmall RandIntGHash - GHash - 200000", 200000);
744}
745
746TEST(ghash, MultiRandIntMurmur2a2000)
747{
749
750 multi_small_ghash_tests(ghash, "MultiSmall RandIntGHash - Murmur2a - 2000", 2000);
751}
752
753TEST(ghash, MultiRandIntMurmur2a200000)
754{
756
757 multi_small_ghash_tests(ghash, "MultiSmall RandIntGHash - Murmur2a - 200000", 200000);
758}
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
File and directory operations.
void * BLI_file_read_text_as_mem(const char *filepath, size_t pad_bytes, size_t *r_size)
Definition storage.cc:502
double BLI_ghash_calc_quality_ex(const GHash *gh, double *r_load, double *r_variance, double *r_prop_empty_buckets, double *r_prop_overloaded_buckets, int *r_biggest_bucket)
Definition BLI_ghash.c:1092
bool BLI_ghashutil_strcmp(const void *a, const void *b)
unsigned int BLI_ghashutil_inthash_p_murmur(const void *ptr)
#define BLI_ghashutil_uinthash_v4_p_murmur
Definition BLI_ghash.h:600
bool BLI_ghash_haskey(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
Definition BLI_ghash.c:819
bool BLI_ghash_pop(GHash *gh, GHashIterState *state, void **r_key, void **r_val) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition BLI_ghash.c:824
void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
Definition BLI_ghash.c:855
unsigned int BLI_ghashutil_strhash_p(const void *ptr)
GHash * BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition BLI_ghash.c:686
#define BLI_ghashutil_uinthash_v4_p
Definition BLI_ghash.h:594
void BLI_ghash_reserve(GHash *gh, unsigned int nentries_reserve)
Definition BLI_ghash.c:696
bool BLI_ghashutil_intcmp(const void *a, const void *b)
unsigned int BLI_ghash_len(const GHash *gh) ATTR_WARN_UNUSED_RESULT
Definition BLI_ghash.c:702
unsigned int BLI_ghashutil_inthash_p(const void *ptr)
unsigned int BLI_ghashutil_strhash_p_murmur(const void *ptr)
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
Definition BLI_ghash.c:731
void BLI_ghash_insert(GHash *gh, void *key, void *val)
Definition BLI_ghash.c:707
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
Definition BLI_ghash.c:860
bool BLI_ghashutil_uinthash_v4_cmp(const void *a, const void *b)
static constexpr bool USE_RESERVE_COUNT
static void print_ghash_stats(GHash *gh)
static void int4_map_tests(MapType &map, const char *id, const uint count)
static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const uint count)
static void int_ghash_tests(GHash *ghash, const char *id, const uint count)
static bool ghashutil_tests_cmp_p(const void *a, const void *b)
static void int_map_tests(MapType &map, const char *id, const uint count)
static constexpr size_t TESTCASE_SIZE_SMALL
static void randint_map_tests(MapType &map, const char *id, const uint count)
static void randint_ghash_tests(GHash *ghash, const char *id, const uint count)
static void multi_small_ghash_tests(GHash *ghash, const char *id, const uint count)
static uint ghashutil_tests_nohash_p(const void *p)
static void str_map_tests(MapType &map, const char *id)
static void str_ghash_tests(GHash *ghash, const char *id)
static char * read_text_corpus()
static void int4_ghash_tests(GHash *ghash, const char *id, const uint count)
Random number functions.
void int BLI_rng_get_int(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition rand.cc:78
struct RNG * BLI_rng_new(unsigned int seed)
Definition rand.cc:39
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1)
Definition rand.cc:58
unsigned int BLI_rng_get_uint(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition rand.cc:83
const char words10k[]
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
Definition string.c:40
unsigned int uint
#define SCOPED_TIMER(name)
Definition BLI_timeit.hh:61
#define POINTER_FROM_INT(i)
#define POINTER_AS_UINT(i)
#define POINTER_AS_INT(i)
#define POINTER_FROM_UINT(i)
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
local_group_size(16, 16) .push_constant(Type b
#define printf
int count
void *(* MEM_mallocN)(size_t len, const char *str)
Definition mallocn.cc:44
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
TEST(BLI_string_utils, BLI_uniquename_cb)
Definition rand.cc:33