Commit Graph

84 Commits

Author SHA1 Message Date
Christopher Berner
eafdc58d0a Run cargo clippy --fix 2023-07-03 11:09:19 -07:00
Slesarew
5a720829fa
feat: support no_std (#143)
* feat: support no_std

`metal` feature supports `no_std` in configuration `default-features = false, features = ["metal"]`.
Float calculation is done via `micromath` crate.

All previously available functionality remains under default `std` feature.

Some tweaking of `python` and `wasm` features was done to compile tests.

* feat: get rid of floats (#2)

* feat: remove conversion to f64, fix features

* chore: uncomment symbols_required checker, fmt

* revert: add cdylib target for python support

* fix: generalize crate type

---------

Co-authored-by: varovainen <99664267+varovainen@users.noreply.github.com>
2023-02-02 18:07:41 -08:00
Christopher Berner
98a9806801 Update to 2021 edition 2021-10-21 18:47:08 -07:00
Christopher Berner
5a851083ed Fix some Clippy warnings 2021-07-27 22:00:38 -07:00
Christopher Berner
562e64d438 Optimize column swapping substep for r > 1
Improves performance by ~4%
2021-02-05 19:51:08 -08:00
Christopher Berner
1241928a84 Optimize column swapping substep for r=1
Improves performance by ~1%
2021-02-05 19:51:08 -08:00
Christopher Berner
67a90ede4e Replace retain() with position() + swap_remove()
This improves performance by 1-2%
2021-02-05 19:51:08 -08:00
Christopher Berner
5e506b5b78 Merge .map().filter() into .filter_map() 2021-02-05 19:51:08 -08:00
Christopher Berner
7cfef09bc6 Don't eliminate sparse values from HDPC
These are never read, except for debugging, and this improves perf by ~1%
2021-01-17 21:24:08 -08:00
Christopher Berner
42c08b85c8 Remove unnecessary condition
This is always true, since we're in the r = 1 case
2021-01-17 21:24:08 -08:00
Christopher Berner
6546b714ad Skip elimination in V section of A during first phase
This is safe due to Errata 11, and speeds up performance by a couple
percent
2021-01-17 10:30:34 -08:00
Christopher Berner
24235dd213 Optimize first phase to call ones_in_column() only once for r = 1 case 2020-12-26 20:46:47 -08:00
Christopher Berner
3e88b065dd Optimize graph substep
Use a union-find data structure which is incrementally updated, instead
of always recomputing the entire graph

This improves performance by 5-10%
2020-12-26 10:05:53 -08:00
Christopher Berner
26c9c2f6a0 Remove eliminate_leading_value()
Also fix usage and semantics of selection helper .resize() method.
Previously, it said all values in first column had to be zero, but it
was called before those were eliminated
2020-12-26 10:05:53 -08:00
Christopher Berner
7b0d1c5cff Remove X matrix from release builds
This improve performance on small symbol counts by ~5%
2020-12-06 15:36:43 -08:00
Christopher Berner
3a05d7be3e Add BinaryOctetVec
Improves encoding speed of large symbol counts by ~5%
2020-12-06 08:15:21 -08:00
Christopher Berner
c4d227fba1 Optimize memory layout of dense U matrix
Previously we used column major ordering. Switch to row major to
optimize sequential access of rows which is much more common in the
first phase, and can also be used in the fourth phase

This improves performance by ~10% on large symbol counts
2020-11-28 21:08:35 -08:00
Christopher Berner
3a4068a726 Fix typo in spelling of "access" 2020-11-28 17:22:50 -08:00
Christopher Berner
8b462f5c83 Optimize processing of U matrix
Optimize Phases 2-5 to avoid writes to the first i columns.
Additionally, use pre-computed ops from first phase to implement third &
fifth phases

This improves encoding performance by ~15%, especially on large symbol
counts
2020-11-27 21:36:17 -08:00
Christopher Berner
a96272a0c7 Remove useless cfg guard 2020-11-23 20:00:42 -08:00
Christopher Berner
95b6b5ae91 Make serde support optional 2020-08-30 09:39:39 -07:00
Christopher Berner
f796c55332 Remove unnecessary Vec allocation 2020-01-26 21:41:21 -08:00
Christopher Berner
7d29fd95ef Remove outdated TODOs 2020-01-26 21:41:21 -08:00
Christopher Berner
c244828d71 Various minor refactorings 2020-01-26 10:15:56 -08:00
Anders Martinsson
04786d26fd Add operation vectors for better encoding performance
Using stored operation vectors when generating intermediate symbols make
encoding around three times faster (depends on block size).

Signed-off-by: Anders Martinsson <anders.martinsson@intinor.se>
2020-01-26 10:15:56 -08:00
Christopher Berner
f0177f9311 Convert column iterator to return only 1-valued rows 2020-01-19 11:08:40 -08:00
Christopher Berner
87f8e7ae81 Remove logic to update column index 2020-01-19 11:08:40 -08:00
Christopher Berner
c07da3e667 Index adjacent nodes in graph
Speeds up graph selection step by ~3x
2020-01-19 11:08:40 -08:00
Christopher Berner
69187f6e2d Remove scratch graph object 2020-01-19 11:08:40 -08:00
Christopher Berner
f6829719e2 Further optimize graph memory usage
Reduces selection helper memory usage by ~50%
2020-01-19 11:08:40 -08:00
Christopher Berner
e5941cd5a4 Restructure graph to be more memory efficient 2020-01-19 11:08:40 -08:00
Christopher Berner
cccd950f1e Improve accuracy of graph memory tracking 2020-01-19 11:08:40 -08:00
Christopher Berner
8d3de9a4bc Document TODO 2020-01-19 11:08:40 -08:00
Christopher Berner
8d75de4d97 Reduce first phase stats memory usage
Reduces memory by ~1MB for large symbol counts
2020-01-19 11:08:40 -08:00
Christopher Berner
c7d16f2c89 Replace unnecessary usage of UsizeArrayMap 2020-01-19 11:08:40 -08:00
Christopher Berner
792b68638d Add memory approximation for first phase stats struct 2020-01-19 11:08:40 -08:00
Christopher Berner
01fcca7364 Accurately report column index memory usage 2020-01-19 11:08:40 -08:00
Christopher Berner
b60387a132 Remove unaccessed columns from X
Reduces memory usage by ~10%
2020-01-19 11:08:40 -08:00
Christopher Berner
f95998b0ff Add approximate memory analysis 2020-01-19 11:08:40 -08:00
Christopher Berner
bf1291253b Remove unnecessary counting of values greater than one 2020-01-19 11:08:40 -08:00
Christopher Berner
49448be936 Remove unnecessary support for non-binary values in binary matrices 2020-01-19 11:08:40 -08:00
Christopher Berner
5d57d3751e Separate binary and octet matrix classes 2020-01-19 11:08:40 -08:00
Christopher Berner
dbb0a7f7d3 Remove unnecessary normalization 2020-01-19 11:08:40 -08:00
Christopher Berner
ffee5f0d59 Remove special HDPC handling in selection helper 2020-01-19 11:08:40 -08:00
Christopher Berner
3bf4e1dfda Document usage of Errata 2 2020-01-19 11:08:40 -08:00
Christopher Berner
7ad2d331dd Remove dense row support from sparse matrix 2020-01-19 11:08:40 -08:00
Christopher Berner
7f3477d3de Separate HDPC rows from A matrix in PI solver
The HDPC rows are only non-binary values, so store them separately
to allow for more optimizations in the future.
2020-01-19 11:08:40 -08:00
Christopher Berner
b1f0f920c5 Document errata for RFC6330 2020-01-19 11:08:40 -08:00
Christopher Berner
f6fbcf072e Defer operations on symbols
This makes the algorithm more cache friendly, by first performing all
the calculations on the constraint matrix, and then applying the
operations to the Symbols

Improves performance on very large symbol counts (50k) by ~10%
2020-01-19 11:08:40 -08:00
Cem Karan
4a68f2529d feat: Derived serde::{Serialize, Deserialize} on all public types.
This should make it possible to use serde to serialize and deserialize
encoders/decoders while they are in use.  This is makes it possible to
ship them between processes as needed.
2020-01-09 19:34:21 -08:00