Skip to content

Commit 0f259bc

Browse files
committed
breaking some _get names(!) + docs + minor fixes
1 parent d203ca6 commit 0f259bc

File tree

15 files changed

+392
-288
lines changed

15 files changed

+392
-288
lines changed

examples/chat.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ FIO_SFUNC void on_data_first_line(fio_s *io, char *name, size_t len) {
110110
goto error_name_too_short;
111111
if (len > 30)
112112
goto error_name_too_long;
113-
client_s *c = fio_udata_get(io);
113+
client_s *c = fio_udata(io);
114114
memcpy(c->name, name, len);
115115
c->name[len] = 0;
116116
c->name[31] = (char)len;
@@ -138,7 +138,7 @@ FIO_SFUNC void on_data_first_line(fio_s *io, char *name, size_t len) {
138138

139139
/** Manages chat messages */
140140
FIO_SFUNC void on_data_message_line(fio_s *io, char *msg, size_t len) {
141-
client_s *c = fio_udata_get(io);
141+
client_s *c = fio_udata(io);
142142
char *buf = fio_bstr_write2(NULL,
143143
FIO_STRING_WRITE_STR2(c->name, c->name[31]),
144144
FIO_STRING_WRITE_STR2(": ", 2),
@@ -163,7 +163,7 @@ FIO_IFUNC int on_data_read(fio_s *io) {
163163
size_t r = fio_read(io, buf, CHAT_MAX_MESSAGE_LEN);
164164
if (!r)
165165
return -1;
166-
client_s *c = fio_udata_get(io);
166+
client_s *c = fio_udata(io);
167167
fio_stream_add(&c->input, fio_stream_pack_data(buf, r, 0, 1, NULL));
168168
return 0;
169169
}
@@ -173,7 +173,7 @@ FIO_IFUNC int on_data_process_line(fio_s *io,
173173
char tmp[CHAT_MAX_MESSAGE_LEN];
174174
char *buf = tmp;
175175
size_t len = CHAT_MAX_MESSAGE_LEN;
176-
client_s *c = fio_udata_get(io);
176+
client_s *c = fio_udata(io);
177177
fio_stream_read(&c->input, &buf, &len);
178178
if (!len)
179179
return -1;

fio-stl.h

Lines changed: 144 additions & 94 deletions
Large diffs are not rendered by default.

fio-stl.md

Lines changed: 50 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9971,10 +9971,10 @@ void *fio_udata_set(fio_s *io, void *udata);
99719971

99729972
Associates a new `udata` pointer with the IO, returning the old `udata`
99739973

9974-
#### `fio_udata_get`
9974+
#### `fio_udata`
99759975

99769976
```c
9977-
void *fio_udata_get(fio_s *io);
9977+
void *fio_udata(fio_s *io);
99789978
```
99799979

99809980
Returns the `udata` pointer associated with the IO.
@@ -10067,10 +10067,10 @@ void *fio_tls_set(fio_s *io, void *tls);
1006710067

1006810068
Associates a new `tls` pointer with the IO, returning the old `tls`
1006910069

10070-
#### `fio_tls_get`
10070+
#### `fio_tls`
1007110071

1007210072
```c
10073-
void *fio_tls_get(fio_s *io);
10073+
void *fio_tls(fio_s *io);
1007410074
```
1007510075

1007610076
Returns the `tls` pointer associated with the IO.
@@ -10083,10 +10083,10 @@ fio_protocol_s *fio_protocol_set(fio_s *io, fio_protocol_s *protocol);
1008310083

1008410084
Sets a new protocol object (allows for dynamic protocol substitution). `NULL` is a valid "only-write" protocol.
1008510085

10086-
#### `fio_protocol_get`
10086+
#### `fio_protocol`
1008710087

1008810088
```c
10089-
fio_protocol_s *fio_protocol_get(fio_s *io);
10089+
fio_protocol_s *fio_protocol(fio_s *io);
1009010090
```
1009110091

1009210092
Returns a pointer to the current protocol object.
@@ -10128,10 +10128,10 @@ void some_callback(fio_s *io) {
1012810128
}
1012910129
```
1013010130

10131-
#### `fio_fd_get`
10131+
#### `fio_fd`
1013210132

1013310133
```c
10134-
int fio_fd_get(fio_s *io);
10134+
int fio_fd(fio_s *io);
1013510135
```
1013610136

1013710137
Returns the socket file descriptor (fd) associated with the IO.
@@ -10281,6 +10281,8 @@ struct fio_protocol_s {
1028110281
* The zero value (0) is the same as the timeout limit (FIO_SRV_TIMEOUT_MAX).
1028210282
*/
1028310283
uint32_t timeout;
10284+
/** The number of bytes to reserve for the fio_iomem buffer. */
10285+
uint32_t iomem_size;
1028410286
};
1028510287
```
1028610288

@@ -12505,62 +12507,62 @@ Running AppendedZeroesTest .......... PASS
1250512507
[[[ Speed Tests ]]]
1250612508

1250712509
Bulk speed test - 262144-byte keys
12508-
Alignment 7 - 17.892 bytes/cycle - 51190.53 MiB/sec @ 3 ghz
12509-
Alignment 6 - 17.906 bytes/cycle - 51229.69 MiB/sec @ 3 ghz
12510-
Alignment 5 - 17.900 bytes/cycle - 51211.34 MiB/sec @ 3 ghz
12511-
Alignment 4 - 17.889 bytes/cycle - 51179.97 MiB/sec @ 3 ghz
12512-
Alignment 3 - 17.901 bytes/cycle - 51215.52 MiB/sec @ 3 ghz
12513-
Alignment 2 - 17.877 bytes/cycle - 51145.72 MiB/sec @ 3 ghz
12514-
Alignment 1 - 17.857 bytes/cycle - 51089.71 MiB/sec @ 3 ghz
12515-
Alignment 0 - 19.055 bytes/cycle - 54516.81 MiB/sec @ 3 ghz
12516-
Average - 18.035 bytes/cycle - 51597.41 MiB/sec @ 3 ghz
12510+
Alignment 7 - 17.861 bytes/cycle - 51100.77 MiB/sec @ 3 ghz
12511+
Alignment 6 - 17.833 bytes/cycle - 51019.28 MiB/sec @ 3 ghz
12512+
Alignment 5 - 17.832 bytes/cycle - 51018.87 MiB/sec @ 3 ghz
12513+
Alignment 4 - 17.853 bytes/cycle - 51077.60 MiB/sec @ 3 ghz
12514+
Alignment 3 - 17.844 bytes/cycle - 51051.63 MiB/sec @ 3 ghz
12515+
Alignment 2 - 17.854 bytes/cycle - 51080.37 MiB/sec @ 3 ghz
12516+
Alignment 1 - 17.912 bytes/cycle - 51245.99 MiB/sec @ 3 ghz
12517+
Alignment 0 - 19.064 bytes/cycle - 54541.55 MiB/sec @ 3 ghz
12518+
Average - 18.006 bytes/cycle - 51517.01 MiB/sec @ 3 ghz
1251712519

1251812520
Small key speed test - 1-byte keys - 13.90 cycles/hash
12519-
Small key speed test - 2-byte keys - 14.62 cycles/hash
12520-
Small key speed test - 3-byte keys - 14.24 cycles/hash
12521-
Small key speed test - 4-byte keys - 14.00 cycles/hash
12522-
Small key speed test - 5-byte keys - 14.28 cycles/hash
12523-
Small key speed test - 6-byte keys - 14.95 cycles/hash
12521+
Small key speed test - 2-byte keys - 14.59 cycles/hash
12522+
Small key speed test - 3-byte keys - 14.27 cycles/hash
12523+
Small key speed test - 4-byte keys - 14.32 cycles/hash
12524+
Small key speed test - 5-byte keys - 14.81 cycles/hash
12525+
Small key speed test - 6-byte keys - 14.99 cycles/hash
1252412526
Small key speed test - 7-byte keys - 15.00 cycles/hash
1252512527
Small key speed test - 8-byte keys - 14.00 cycles/hash
12526-
Small key speed test - 9-byte keys - 14.00 cycles/hash
12528+
Small key speed test - 9-byte keys - 14.15 cycles/hash
1252712529
Small key speed test - 10-byte keys - 14.00 cycles/hash
1252812530
Small key speed test - 11-byte keys - 14.00 cycles/hash
1252912531
Small key speed test - 12-byte keys - 14.00 cycles/hash
1253012532
Small key speed test - 13-byte keys - 14.00 cycles/hash
12531-
Small key speed test - 14-byte keys - 14.00 cycles/hash
12533+
Small key speed test - 14-byte keys - 14.11 cycles/hash
1253212534
Small key speed test - 15-byte keys - 14.00 cycles/hash
12533-
Small key speed test - 16-byte keys - 14.61 cycles/hash
12534-
Small key speed test - 17-byte keys - 15.61 cycles/hash
12535-
Small key speed test - 18-byte keys - 15.68 cycles/hash
12536-
Small key speed test - 19-byte keys - 15.67 cycles/hash
12537-
Small key speed test - 20-byte keys - 15.61 cycles/hash
12538-
Small key speed test - 21-byte keys - 15.66 cycles/hash
12539-
Small key speed test - 22-byte keys - 15.64 cycles/hash
12540-
Small key speed test - 23-byte keys - 15.66 cycles/hash
12541-
Small key speed test - 24-byte keys - 15.71 cycles/hash
12542-
Small key speed test - 25-byte keys - 15.63 cycles/hash
12543-
Small key speed test - 26-byte keys - 15.64 cycles/hash
12544-
Small key speed test - 27-byte keys - 15.64 cycles/hash
12545-
Small key speed test - 28-byte keys - 15.65 cycles/hash
12546-
Small key speed test - 29-byte keys - 15.66 cycles/hash
12547-
Small key speed test - 30-byte keys - 15.64 cycles/hash
12548-
Small key speed test - 31-byte keys - 15.65 cycles/hash
12549-
Average 14.914 cycles/hash
12535+
Small key speed test - 16-byte keys - 14.72 cycles/hash
12536+
Small key speed test - 17-byte keys - 15.74 cycles/hash
12537+
Small key speed test - 18-byte keys - 15.62 cycles/hash
12538+
Small key speed test - 19-byte keys - 15.60 cycles/hash
12539+
Small key speed test - 20-byte keys - 15.66 cycles/hash
12540+
Small key speed test - 21-byte keys - 15.83 cycles/hash
12541+
Small key speed test - 22-byte keys - 15.69 cycles/hash
12542+
Small key speed test - 23-byte keys - 15.73 cycles/hash
12543+
Small key speed test - 24-byte keys - 15.63 cycles/hash
12544+
Small key speed test - 25-byte keys - 15.67 cycles/hash
12545+
Small key speed test - 26-byte keys - 15.66 cycles/hash
12546+
Small key speed test - 27-byte keys - 15.76 cycles/hash
12547+
Small key speed test - 28-byte keys - 15.67 cycles/hash
12548+
Small key speed test - 29-byte keys - 15.68 cycles/hash
12549+
Small key speed test - 30-byte keys - 15.65 cycles/hash
12550+
Small key speed test - 31-byte keys - 15.64 cycles/hash
12551+
Average 14.971 cycles/hash
1255012552

1255112553
[[[ 'Hashmap' Speed Tests ]]]
1255212554

1255312555
std::unordered_map
12554-
Init std HashMapTest: 147.319 cycles/op (466569 inserts, 1% deletions)
12555-
Running std HashMapTest: 88.414 cycles/op (1.1 stdv, found 461903)
12556+
Init std HashMapTest: 148.866 cycles/op (466569 inserts, 1% deletions)
12557+
Running std HashMapTest: 85.492 cycles/op (1.0 stdv, found 461903)
1255612558

1255712559
greg7mdp/parallel-hashmap
12558-
Init fast HashMapTest: 138.590 cycles/op (466569 inserts, 1% deletions)
12559-
Running fast HashMapTest: 88.165 cycles/op (0.6 stdv, found 461903)
12560+
Init fast HashMapTest: 158.746 cycles/op (466569 inserts, 1% deletions)
12561+
Running fast HashMapTest: 74.728 cycles/op (2.5 stdv, found 461903)
1256012562

1256112563
facil.io HashMap
12562-
Init fast fio_map_s Test: 75.517 cycles/op (466569 inserts, 1% deletions)
12563-
Running fast fio_map_s Test: 42.490 cycles/op (0.2 stdv, found 461903)
12564+
Init fast fio_map_s Test: 62.909 cycles/op (466569 inserts, 1% deletions)
12565+
Running fast fio_map_s Test: 32.332 cycles/op (0.2 stdv, found 461903)
1256412566
....... PASS
1256512567

1256612568
[[[ Avalanche Tests ]]]
@@ -13631,7 +13633,7 @@ Testing collisions (low 28-44 bits) - Worst is 41 bits: 261/255 (1.02x)
1363113633

1363213634

1363313635
Input vcode 0x00000001, Output vcode 0x00000001, Result vcode 0x00000001
13634-
Verification value is 0x00000001 - Testing took 685.179970 seconds
13636+
Verification value is 0x00000001 - Testing took 681.305909 seconds
1363513637
-------------------------------------------------------------------------------
1363613638
```
1363713639

fio-stl/000 core.h

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ supports macros that will help detect and validate it's version.
3131
/** PATCH version: Bug fixes, minor features may be added. */
3232
#define FIO_VERSION_PATCH 0
3333
/** Build version: optional build info (string), i.e. "beta.02" */
34-
#define FIO_VERSION_BUILD "alpha.08"
34+
#define FIO_VERSION_BUILD "alpha.09"
3535

3636
#ifdef FIO_VERSION_BUILD
3737
/** Version as a String literal (MACRO). */
@@ -209,7 +209,7 @@ Address Sanitizer Detection
209209
/* *****************************************************************************
210210
Intrinsic Availability Flags
211211
***************************************************************************** */
212-
#if 1 /* Allow Intrinsic / SIMD / Neon ? */
212+
#if !defined(DEBUG) /* Allow Intrinsic / SIMD / Neon ? */
213213
#if defined(__ARM_FEATURE_CRYPTO) && \
214214
(defined(__ARM_NEON) || defined(__ARM_NEON__)) && \
215215
__has_include("arm_acle.h") && __has_include("arm_neon.h")
@@ -2682,10 +2682,10 @@ typedef union {
26822682
uint16x8_t x16[1];
26832683
uint8x16_t x8[1];
26842684
#elif __has_attribute(vector_size)
2685-
uint64_t x64 __attribute__((vector_size(16)));
2686-
uint64_t x32 __attribute__((vector_size(16)));
2687-
uint64_t x16 __attribute__((vector_size(16)));
2688-
uint64_t x8 __attribute__((vector_size(16)));
2685+
uint64_t __attribute__((vector_size(16))) x64[1];
2686+
uint64_t __attribute__((vector_size(16))) x32[1];
2687+
uint64_t __attribute__((vector_size(16))) x16[1];
2688+
uint64_t __attribute__((vector_size(16))) x8[1];
26892689
#endif
26902690
#if defined(__SIZEOF_INT128__)
26912691
__uint128_t alignment_for_u128_[1];
@@ -2706,10 +2706,10 @@ typedef union {
27062706
uint16x8_t x16[2];
27072707
uint8x16_t x8[2];
27082708
#elif __has_attribute(vector_size)
2709-
uint64_t x64 __attribute__((vector_size(32)));
2710-
uint64_t x32 __attribute__((vector_size(32)));
2711-
uint64_t x16 __attribute__((vector_size(32)));
2712-
uint64_t x8 __attribute__((vector_size(32)));
2709+
uint64_t __attribute__((vector_size(32))) x64[1];
2710+
uint64_t __attribute__((vector_size(32))) x32[1];
2711+
uint64_t __attribute__((vector_size(32))) x16[1];
2712+
uint64_t __attribute__((vector_size(32))) x8[1];
27132713
#endif
27142714
#if defined(__SIZEOF_INT128__)
27152715
__uint128_t alignment_for_u128_[2];
@@ -2734,10 +2734,10 @@ typedef union {
27342734
uint16x8_t x16[4];
27352735
uint8x16_t x8[4];
27362736
#elif __has_attribute(vector_size)
2737-
uint64_t x64 __attribute__((vector_size(64)));
2738-
uint64_t x32 __attribute__((vector_size(64)));
2739-
uint64_t x16 __attribute__((vector_size(64)));
2740-
uint64_t x8 __attribute__((vector_size(64)));
2737+
uint64_t __attribute__((vector_size(64))) x64[1];
2738+
uint64_t __attribute__((vector_size(64))) x32[1];
2739+
uint64_t __attribute__((vector_size(64))) x16[1];
2740+
uint64_t __attribute__((vector_size(64))) x8[1];
27412741
#endif
27422742
} fio_u512 FIO_ALIGN(16);
27432743

@@ -2757,10 +2757,10 @@ typedef union {
27572757
uint16x8_t x16[8];
27582758
uint8x16_t x8[8];
27592759
#elif __has_attribute(vector_size)
2760-
uint64_t x64 __attribute__((vector_size(128)));
2761-
uint64_t x32 __attribute__((vector_size(128)));
2762-
uint64_t x16 __attribute__((vector_size(128)));
2763-
uint64_t x8 __attribute__((vector_size(128)));
2760+
uint64_t __attribute__((vector_size(128))) x64[1];
2761+
uint64_t __attribute__((vector_size(128))) x32[1];
2762+
uint64_t __attribute__((vector_size(128))) x16[1];
2763+
uint64_t __attribute__((vector_size(128))) x8[1];
27642764
#endif
27652765
} fio_u1024 FIO_ALIGN(16);
27662766

@@ -2781,10 +2781,10 @@ typedef union {
27812781
uint16x8_t x16[16];
27822782
uint8x16_t x8[16];
27832783
#elif __has_attribute(vector_size)
2784-
uint64_t x64 __attribute__((vector_size(256)));
2785-
uint64_t x32 __attribute__((vector_size(256)));
2786-
uint64_t x16 __attribute__((vector_size(256)));
2787-
uint64_t x8 __attribute__((vector_size(256)));
2784+
uint64_t __attribute__((vector_size(256))) x64[1];
2785+
uint64_t __attribute__((vector_size(256))) x32[1];
2786+
uint64_t __attribute__((vector_size(256))) x16[1];
2787+
uint64_t __attribute__((vector_size(256))) x8[1];
27882788
#endif
27892789
} fio_u2048 FIO_ALIGN(16);
27902790

@@ -2806,10 +2806,10 @@ typedef union {
28062806
uint16x8_t x16[32];
28072807
uint8x16_t x8[32];
28082808
#elif __has_attribute(vector_size)
2809-
uint64_t x64 __attribute__((vector_size(512)));
2810-
uint64_t x32 __attribute__((vector_size(512)));
2811-
uint64_t x16 __attribute__((vector_size(512)));
2812-
uint64_t x8 __attribute__((vector_size(512)));
2809+
uint64_t __attribute__((vector_size(512))) x64[1];
2810+
uint64_t __attribute__((vector_size(512))) x32[1];
2811+
uint64_t __attribute__((vector_size(512))) x16[1];
2812+
uint64_t __attribute__((vector_size(512))) x8[1];
28132813
#endif
28142814
} fio_u4096 FIO_ALIGN(16);
28152815

@@ -2943,7 +2943,7 @@ Vector Helpers - Vector Math Operations
29432943
do { \
29442944
for (size_t i__ = 0; i__ < (sizeof((t).u##bits) / sizeof((t).u##bits[0])); \
29452945
++i__) \
2946-
(t).u##bits[i__] = op(a).u##bits[i__]; \
2946+
(t).u##bits[i__] = op((a).u##bits[i__]); \
29472947
} while (0)
29482948
#endif /* FIO_HAS_UX */
29492949

@@ -2957,13 +2957,14 @@ Vector Helpers - Vector Math Operations
29572957
} while (0)
29582958

29592959
#define FIO___UXXX_DEF_OP(total_bits, bits, opnm, op) \
2960-
FIO_IFUNC void fio_u##total_bits##_##opnm##bits(fio_u##total_bits *target, \
2961-
fio_u##total_bits *a, \
2962-
fio_u##total_bits *b) { \
2960+
FIO_IFUNC void fio_u##total_bits##_##opnm##bits( \
2961+
fio_u##total_bits *target, \
2962+
const fio_u##total_bits *a, \
2963+
const fio_u##total_bits *b) { \
29632964
FIO_MATH_UXXX_OP(((target)[0]), ((a)[0]), ((b)[0]), bits, op); \
29642965
} \
29652966
FIO_IFUNC void fio_u##total_bits##_c##opnm##bits(fio_u##total_bits *target, \
2966-
fio_u##total_bits *a, \
2967+
const fio_u##total_bits *a, \
29672968
uint##bits##_t b) { \
29682969
FIO_MATH_UXXX_COP(((target)[0]), ((a)[0]), (b), bits, op); \
29692970
} \
@@ -2975,8 +2976,8 @@ Vector Helpers - Vector Math Operations
29752976
}
29762977
#define FIO___UXXX_DEF_OP2(total_bits, bits, opnm, op) \
29772978
FIO_IFUNC void fio_u##total_bits##_##opnm(fio_u##total_bits *target, \
2978-
fio_u##total_bits *a, \
2979-
fio_u##total_bits *b) { \
2979+
const fio_u##total_bits *a, \
2980+
const fio_u##total_bits *b) { \
29802981
FIO_MATH_UXXX_OP(((target)[0]), ((a)[0]), ((b)[0]), bits, op); \
29812982
}
29822983

@@ -2997,7 +2998,7 @@ Vector Helpers - Vector Math Operations
29972998
FIO___UXXX_DEF_OP4T_INNER(total_bits, xor, ^) \
29982999
FIO___UXXX_DEF_OP2(total_bits, 64, xor, ^) \
29993000
FIO_IFUNC void fio_u##total_bits##_inv(fio_u##total_bits *target, \
3000-
fio_u##total_bits *a) { \
3001+
const fio_u##total_bits *a) { \
30013002
FIO_MATH_UXXX_SOP(((target)[0]), ((a)[0]), 64, ~); \
30023003
}
30033004

@@ -3044,7 +3045,7 @@ Vector Helpers - Multi-Precision Math
30443045
return borrow; \
30453046
} \
30463047
/** Returns -1, 0, or 1 if a < b, a == b or a > a (respectively). */ \
3047-
FIO_MIFN int fio_u##bits##_cmp(fio_u##bits *a, fio_u##bits *b) { \
3048+
FIO_MIFN int fio_u##bits##_cmp(const fio_u##bits *a, const fio_u##bits *b) { \
30483049
unsigned is_eq = 1; \
30493050
unsigned is_bigger = 0; \
30503051
for (size_t i = (bits / 64); i--;) { \

fio-stl/002 random.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ SFUNC uint64_t fio_risky_hash(const void *data_, size_t len, uint64_t seed) {
147147
v[i + 4] += w[i]; \
148148
} \
149149
} while (0)
150-
151150
/* Approach inspired by komihash, copyrighted: Aleksey Vaneev, MIT license */
152151
const uint8_t *data = (const uint8_t *)data_;
153152
uint64_t v[8] FIO_ALIGN(16), w[8] FIO_ALIGN(16) = {0};
@@ -191,7 +190,6 @@ SFUNC uint64_t fio_risky_hash(const void *data_, size_t len, uint64_t seed) {
191190
v[0] = w[5] + fio_math_mulc64(w[4], w[6], v + 1);
192191
v[0] += v[1];
193192
return v[0];
194-
195193
#undef FIO___RISKY_HASH_ROUND64
196194
}
197195

fio-stl/102 poll kqueue.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ SFUNC int fio_poll_review(fio_poll_s *p, size_t timeout_) {
131131
struct kevent events[FIO_POLL_MAX_EVENTS] = {{0}};
132132

133133
const struct timespec timeout = {
134-
.tv_sec = (time_t)(timeout_ / 1024),
135-
.tv_nsec = (suseconds_t)((timeout_ & (1023UL)) * 1000000)};
134+
.tv_sec = (time_t)(timeout_ / 1000),
135+
.tv_nsec = (suseconds_t)((timeout_ % 1000) * 1000000)};
136136
/* wait for events and handle them */
137137
int active_count =
138138
kevent(p->fd, NULL, 0, events, FIO_POLL_MAX_EVENTS, &timeout);

0 commit comments

Comments
 (0)