Performance: key lookup improvements with gperf -l and -C (See ECC-525)

This commit is contained in:
Shahram Najm 2018-01-22 17:38:52 +00:00
parent f209b51d5c
commit 5c9a446a53
5 changed files with 10391 additions and 8050 deletions

View File

@ -1100,7 +1100,7 @@ void grib_math_delete(grib_context *c, grib_math *m);
grib_math *grib_math_new(grib_context *c, const char *formula, int *err);
/* grib_hash_keys.c */
struct grib_keys_hash *grib_keys_hash_get(const char *str, unsigned int len);
const struct grib_keys_hash *grib_keys_hash_get(const char *str, unsigned int len);
grib_itrie *grib_hash_keys_new(grib_context *c, int *count);
void grib_hash_keys_delete(grib_itrie *t);
int grib_hash_keys_get_id(grib_itrie *t, const char *key);

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ cd ../src
# Editing keys grib_hash_keys.c
gperf -I -t -G -H hash_keys -N grib_keys_hash_get -m 3 ../tests/keys |\
gperf -l -C -I -t -G -H hash_keys -N grib_keys_hash_get -m 3 ../tests/keys |\
sed '/__attribute__ ((__gnu_inline__))/d' |\
sed s/__inline//g | sed s/inline//g > grib_hash_keys.c

2629
tests/keys

File diff suppressed because it is too large Load Diff

View File

@ -10,12 +10,20 @@
. ./include.sh
set -e
[ -z "$ECCODES_DEFINITION_PATH" ] | ECCODES_DEFINITION_PATH=`${tools_dir}/codes_info -d`
if [ -z "$ECCODES_DEFINITION_PATH" ]; then
ECCODES_DEFINITION_PATH=`${tools_dir}/codes_info -d`
fi
GRIB_LIST_KEYS=${tools_dir}/grib_list_keys
if [ ! -x $GRIB_LIST_KEYS ]; then
# Get it from environment variable
GRIB_LIST_KEYS=$GRIB_LIST_KEYS_EXE
fi
touch tmp$$
for file in `find $ECCODES_DEFINITION_PATH -name '*.def' -print`
do
${tools_dir}/grib_list_keys $file >> tmp$$
${GRIB_LIST_KEYS} $file >> tmp$$
done
cat >keys <<EOF
@ -28,4 +36,3 @@ EOF
cat tmp$$ | sort | uniq | awk 'BEGIN{x=0;}{print $1","++x}' >> keys
#cat tmp$$ | sort | uniq >> keys
rm -f tmp$$