git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: f44ceb4) | patch
Replace random(), pg_erand48(), etc with a better PRNG API and algorithm.
2021年11月29日 02:32:36 +0000 (21:32 -0500)
2021年11月29日 02:33:07 +0000 (21:33 -0500)
commit 3804539e48e794781c6145c7f988f5d507418fa8
Replace random(), pg_erand48(), etc with a better PRNG API and algorithm.

Standardize on xoroshiro128** as our basic PRNG algorithm, eliminating
a bunch of platform dependencies as well as fundamentally-obsolete PRNG
code. In addition, this API replacement will ease replacing the
algorithm again in future, should that become necessary.

xoroshiro128** is a few percent slower than the drand48 family,
but it can produce full-width 64-bit random values not only 48-bit,
and it should be much more trustworthy. It's likely to be noticeably
faster than the platform's random(), depending on which platform you
are thinking about; and we can have non-global state vectors easily,
unlike with random(). It is not cryptographically strong, but neither
are the functions it replaces.

Fabien Coelho, reviewed by Dean Rasheed, Aleksander Alekseev, and myself

Discussion: https://postgr.es/m/alpine.DEB.2.22.394.2105241211230.165418@pseudo
50 files changed:
configure diff | blob | blame | history
configure.ac diff | blob | blame | history
contrib/amcheck/verify_nbtree.c diff | blob | blame | history
contrib/auto_explain/auto_explain.c diff | blob | blame | history
contrib/file_fdw/file_fdw.c diff | blob | blame | history
contrib/postgres_fdw/postgres_fdw.c diff | blob | blame | history
contrib/tablefunc/tablefunc.c diff | blob | blame | history
contrib/tsm_system_rows/tsm_system_rows.c diff | blob | blame | history
contrib/tsm_system_time/tsm_system_time.c diff | blob | blame | history
src/backend/access/gin/ginget.c diff | blob | blame | history
src/backend/access/gist/gistutil.c diff | blob | blame | history
src/backend/access/nbtree/nbtinsert.c diff | blob | blame | history
src/backend/access/spgist/spgdoinsert.c diff | blob | blame | history
src/backend/access/transam/xact.c diff | blob | blame | history
src/backend/commands/analyze.c diff | blob | blame | history
src/backend/executor/nodeSamplescan.c diff | blob | blame | history
src/backend/lib/bloomfilter.c diff | blob | blame | history
src/backend/optimizer/geqo/geqo_random.c diff | blob | blame | history
src/backend/optimizer/geqo/geqo_selection.c diff | blob | blame | history
src/backend/postmaster/postmaster.c diff | blob | blame | history
src/backend/storage/file/fd.c diff | blob | blame | history
src/backend/storage/ipc/dsm.c diff | blob | blame | history
src/backend/storage/lmgr/Makefile diff | blob | blame | history
src/backend/storage/lmgr/s_lock.c diff | blob | blame | history
src/backend/tcop/postgres.c diff | blob | blame | history
src/backend/utils/adt/float.c diff | blob | blame | history
src/backend/utils/misc/sampling.c diff | blob | blame | history
src/bin/initdb/initdb.c diff | blob | blame | history
src/bin/pg_test_fsync/pg_test_fsync.c diff | blob | blame | history
src/bin/pgbench/pgbench.c diff | blob | blame | history
src/bin/pgbench/t/001_pgbench_with_server.pl diff | blob | blame | history
src/common/Makefile diff | blob | blame | history
src/common/pg_prng.c [new file with mode: 0644] blob
src/include/common/pg_prng.h [new file with mode: 0644] blob
src/include/optimizer/geqo.h diff | blob | blame | history
src/include/optimizer/geqo_random.h diff | blob | blame | history
src/include/pg_config.h.in diff | blob | blame | history
src/include/pg_config_manual.h diff | blob | blame | history
src/include/port.h diff | blob | blame | history
src/include/utils/sampling.h diff | blob | blame | history
src/port/Makefile diff | blob | blame | history
src/port/erand48.c [deleted file] blob | blame | history
src/port/random.c [deleted file] blob | blame | history
src/port/srandom.c [deleted file] blob | blame | history
src/test/modules/test_bloomfilter/test_bloomfilter.c diff | blob | blame | history
src/test/modules/test_integerset/test_integerset.c diff | blob | blame | history
src/test/modules/test_rbtree/test_rbtree.c diff | blob | blame | history
src/tools/msvc/Mkvcbuild.pm diff | blob | blame | history
src/tools/msvc/Solution.pm diff | blob | blame | history
src/tools/testint128.c diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /