Matthew Knepley <[email protected]> writes: > Sweeping generalization not actually true. The wrappers do setup the > particular > keys we want inside PETSc,
All 3 invocations of KHASH_INIT amid 500 lines. > and do bundle some multiple operation calls. Some, yes, though some of that bundling produces demonstrably less efficient interfaces. commit da33aca0a8f0fe1631697dcf59d191f75b34b5c6 Author: Matthew G. Knepley <[email protected]> Date: Fri Nov 8 15:40:59 2013 -0600 Sys ex26: Jed is right that this is much faster Modified src/sys/examples/tests/ex26.c diff --git a/src/sys/examples/tests/ex26.c b/src/sys/examples/tests/ex26.c index e8cc50a..30ed523 100644 --- a/src/sys/examples/tests/ex26.c +++ b/src/sys/examples/tests/ex26.c @@ -22,8 +22,13 @@ int main(int argc, char **argv) key.i = PetscMin(i, j); key.j = PetscMax(i, j); +#if 1 + khint_t ret, idx = kh_put(HASHIJ, table->ht, key, &ret); + if (ret == 1) kh_val(table->ht, idx).n = newp++; +#else ierr = PetscHashIJGet(table, key, &p);CHKERRQ(ierr); if (p < 0) {ierr = PetscHashIJAdd(table, key, newp++);CHKERRQ(ierr);} +#endif } } ierr = PetscHashIJDestroy(&table);CHKERRQ(ierr);
signature.asc
Description: PGP signature
