star-hitran

Load line-by-line data from the HITRAN database
git clone git://git.meso-star.fr/star-hitran.git
Log | Files | Refs | README | LICENSE

commit 25db0cef4cc231bbb80f8288ee97b4e9904f40d5
parent eaec4e73717e00874c692925bf8857efb4ead086
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 13 Jan 2026 16:06:34 +0100

shtr: minor update to the read access test bench

Measures linear access speed on a subset of lines in order to limit
execution time when the total number of lines is very large.

Diffstat:
Msrc/shtr_main.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/shtr_main.c b/src/shtr_main.c @@ -258,7 +258,7 @@ bench_line_access(struct shtr_line_list* lines) { struct shtr_line line; struct time t0, t1; - const size_t random_read_count = 10000; + const size_t read_count = 10000; double lines_per_second = 0; int64_t usec = 0; size_t i, n; @@ -269,7 +269,7 @@ bench_line_access(struct shtr_line_list* lines) /* Linear access */ time_current(&t0); - FOR_EACH(i, 0, n) { + FOR_EACH(i, 0, MMIN(n, read_count)) { SHTR(line_list_at(lines, i, &line)); } usec = time_val(time_sub(&t0, time_current(&t1), &t0), TIME_USEC); @@ -278,13 +278,13 @@ bench_line_access(struct shtr_line_list* lines) /* Random access */ time_current(&t0); - FOR_EACH(i, 0, random_read_count) { + FOR_EACH(i, 0, read_count) { const double r = (double)rand() / (double)(RAND_MAX-1); const size_t iline = (size_t)(r * (double)n); SHTR(line_list_at(lines, iline, &line)); } usec = time_val(time_sub(&t0, time_current(&t1), &t0), TIME_USEC); - lines_per_second = 1.e9 * (double)random_read_count / (double)usec; + lines_per_second = 1.e9 * (double)read_count / (double)usec; printf("random access: %g lines per second\n", lines_per_second); }