mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Fix small matters and improve sysconf()
- Fix mkdeps.com out of memory error - Remove static memory from __get_cpu_count() - Add support for passing hyphen to cat in cocmd - Change more ZipOS errors from ENOTSUP to EROFS - Specify mem_unit in sysinfo() output on BSD OSes
This commit is contained in:
parent
eebc24b9cd
commit
3a9cac4892
55 changed files with 411 additions and 262 deletions
|
@ -17,11 +17,14 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/mem/critbit0.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/mem/critbit0.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
struct Bog {
|
||||
|
@ -143,3 +146,26 @@ TEST(critbit0, manual_clear) {
|
|||
ASSERT_TRUE(critbit0_delete(&tree, "hi"));
|
||||
ASSERT_EQ(NULL, tree.root);
|
||||
}
|
||||
|
||||
#define N 500
|
||||
|
||||
char words[N][16];
|
||||
|
||||
void GenerateWords(void) {
|
||||
for (int i = 0; i < N; ++i) {
|
||||
FormatInt32(words[i], rand());
|
||||
}
|
||||
}
|
||||
|
||||
void BuildTree(void) {
|
||||
struct critbit0 tree = {0};
|
||||
for (int i = 0; i < N; ++i) {
|
||||
critbit0_insert(&tree, words[i]);
|
||||
}
|
||||
critbit0_clear(&tree);
|
||||
}
|
||||
|
||||
BENCH(critbit0, bench) {
|
||||
GenerateWords();
|
||||
EZBENCH2("critbit0", donothing, BuildTree());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue