Hard-code global tables' contents instead of calculating them at run-time#131
Hard-code global tables' contents instead of calculating them at run-time#131adrianmay wants to merge 43 commits intotahoe-lafs:masterfrom
Conversation
| tables.c: write.c fec.c fec.h Makefile | ||
| touch tables.c | ||
| gcc -o write write.c && ./write > tables.c |
tox.ini
Outdated
| @@ -1,5 +1,5 @@ | |||
| [tox] | |||
| envlist = py37,py38,pypy3 | |||
| envlist = py37,py38,py310,pypy3 | |||
There was a problem hiding this comment.
I only did that so I could run the tests without downgrading my python. It's off topic really. Maybe there should be another ticket about supporting lots of python versions.
There was a problem hiding this comment.
Regardless, 3.7 and 3.8 are already EOL and 3.9 is done in October so all of those should go.
There was a problem hiding this comment.
In this PR or in a general CI-cleanup one?
#129 would seem a bit more relevant perhaps.
There was a problem hiding this comment.
The CI has current configs (and doesn't use tox).
Seems this is merely developer tooling that has been sitting on the shelf for a while?
Either don't touch or fix I guess?
|
Temporarily putting this in draft while we investigate why tables.c doesn't seem to make it through the whole build system. |
This PR is intended to be merged immediately after #130. On this PR page the present changes are muddled up with those of #130, so I recommend reading this diff instead:
adrianmay/zfec@remove-unsafePerformIO...adrianmay:zfec:init-tables
This PR completely removes
fec_initand Haskell'sinitialize, supplying a C file that lists the numbers in the four global tables verbatim. (Tables that depend on n and k are unaffected.)This sidesteps all the difficulties in making sure
fec_initgets run once (especially in Haskell) and improves performance both by cutting out the run-time calculations and by allowing the 64k table to be loaded into RAM on demand and discarded when not in use.Since #130's version bump was unavoidable, bumping again immediately (because
fec_initdisappears) seems better than the tech-debt of retaining a no-op version offec_init.tables.c has been generated by a program in write.c which includes fec.c. The program populates the tables using the established logic, and then writes their contents to stdout as initialised arrays in C syntax. A new makefile touches tables.c (because fec.c includes it) and runs the program with its stdout piped to write.c. This has been done and the resulting tables.c committed to source control, so this process is not a pre-build step, rather, write.c is just retained in source control for reference. Code and data that's used purely for table generation has been moved to write.c so it won't bloat the library.