Commit Graph

20 Commits

Author SHA1 Message Date
Noa e3582131fe Migrate to Rust 2024 (#3802)
# Description of Changes

It'd be best to review this commit-by-commit, and using
[difftastic](https://difftastic.wilfred.me.uk) to easily tell when
changes are minor in terms of syntax but a line based diff doesn't show
that.

# Expected complexity level and risk

3 - edition2024 does bring changes to drop order, which could cause
issues with locks, but I looked through [all of the warnings that
weren't fixed
automatically](https://gistcdn.githack.com/coolreader18/80485ae5c5f82de1784229cce2febb26/raw/ba80f3fecda66ceb34f4f7ad73b98ea02d4893a2/warnings.html)
and couldn't find any issues.

# Testing

n/a; internal code change
2026-03-03 11:06:52 +00:00
Mazdak Farrokhzad 8348151915 define SmallHashMap in spacetimedb_data_structures (#4136)
# Description of Changes

Defines `SmallHashMap` in `spacetimedb_data_structures`.
The data structure is a hybrid map that is backed by a vector and linear
scan for the first `M` elements.
Then it falls back into a normal hash map.
For the first `N` elements, where `N < M`, the vector is stored inline.
That is, the vector is a `SmallVec<[(K, V); N>`.
The structure is optimized for access patterns where the keys and values
are accessed together,
therefore, keys and values are not stored separately.

# API and ABI breaking changes

None, just additive.

# Expected complexity level and risk

1

# Testing

A comprehensive proptest suite is added for the datastructure.
2026-01-27 15:15:23 +00:00
Mazdak Farrokhzad ed2a18cff7 Bump hashbrown, foldhash; Fix some compile errors in master (#3722)
# Description of Changes

There were mentions of `hashbrown` in the repo that did not go through
`spacetimedb_data_structures::map`.
This caused compile errors on master when running certain tests locally.
These have been replaced with the proper imports.

The PR also bump hashbrown to 0.16.1 and foldhash to 0.2.0.

# API and ABI breaking changes

None

# Expected complexity level and risk

2

# Testing

Covered by existing tests.
2025-11-25 12:17:24 +00:00
Noa 742303ca49 Bump rust-toolchain to rust 1.88 (#2749)
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
2025-07-15 17:39:41 +00:00
Mazdak Farrokhzad 6a8cd7e9e1 Extract object_pool module from PagePool (#2920) 2025-07-04 13:47:26 +00:00
Viktor Szépe f6da9e1f5f Fix typos (#2812)
Signed-off-by: Viktor Szépe <viktor@szepe.net>
2025-06-04 16:33:32 +00:00
Mazdak Farrokhzad c3803ae278 Cheaper Table::clone_structure (#2776)
Signed-off-by: Phoebe Goldman <phoebe@goldman-tribe.org>
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
2025-05-23 13:40:35 +00:00
Mazdak Farrokhzad b34caf8306 Rust SDK: Deduplicate rows accross queries (#2286)
Signed-off-by: Mazdak Farrokhzad <twingoow@gmail.com>
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
2025-02-21 21:12:29 +00:00
james gilles 8a317041d4 Update Rust module documentation (#2050)
Co-authored-by: Phoebe Goldman <phoebe@goldman-tribe.org>
2025-02-21 03:48:46 +00:00
Noa c4e637e98b Energy metering for persistent memory usage (#766) 2024-10-15 17:58:34 +00:00
james gilles 98faf7d4e1 Add backwards-compatible validation for RawModuleDefV8. (#1606) 2024-08-29 10:10:53 +00:00
james gilles 7057d9fb1f Add helpers and change CollectAllErrors to be more composable (#1586) 2024-08-13 20:26:08 +00:00
james gilles c046c0b6aa Add ErrorStream combinator (#1543)
Co-authored-by: James Gilles <jgilles@clockworklabs.io>
2024-07-26 19:42:21 +00:00
Mazdak Farrokhzad 89aecd15e3 Split ColumnOp into one with row indices and one with FieldName & other enabled changes (#1207)
* 1. Split ColumnOp into ColumnOp & FieldOp, former storing ColId
2. Shrink SqlAst to 80 bytes, so it can be passed in registers
3. Store end-result Header in IndexSemiJoin
4. Remove operational use of Header in ColumnOp & build_query
5. Simplify RowRef::{get, project, project_owned}

* Make parts of build_query actually infallible.

1. Make IndexSemiJoin::filter infallible.
2. Make ColumnOp::compare and friends infallible.
3. Make RowRef::{get, project, project_owned} infallible.

* Make RelOps::next itself infallible

* 1. with_select{_cmp}: ensure type safety o query exec cannot panic
2. Document RelValue::{get, read_or_take_column, project_owned}
3. Refactor optimize_select
4. Ensure in optimize_select that conditions are merged with preceding selects

* remove RelOps::{head, row_count}; head is redundant & row_count is useless

* remove Relation trait; it does not carry its weight

* make build_query infallible

* simplify IndexSemiJoin, make it slightly less branchy

* simplify try_index_join

* split IndexSemiJoin into Left & Right parts

* move get_field_pos to test code

* move test version of build_query to test code
2024-06-03 16:45:32 +00:00
Noa 3b754f10b1 Bump to Rust 1.78 (#1205)
* Bump to rust 1.78

* Fix lints
2024-05-08 14:20:12 +00:00
Mazdak Farrokhzad 344861f290 use nohasher_hash and ahash instead of siphash13 (#1040)
* use nohasher_hash and ahash instead of siphash13

* re-export types in spacetimedb_data_structures::map
2024-04-05 17:30:51 +00:00
Mazdak Farrokhzad a68ad8f85f add ColList: a compact repr of NonEmpty<ColId>, 8 vs 32 bytes (#730) 2024-01-19 23:44:19 +00:00
Noa 5a2b37b401 Update to rust 1.74 (#589)
* Update to rust 1.74

* Fix 1.74 clippy lints
2023-11-21 21:04:31 +00:00
Mazdak Farrokhzad 22fd5d7273 Add the slim_slice data-structures (#528)
* add the slim_slice data-structures

* slim_slice: addres some review comments

* slim_slice: add basic SlimSmallSliceBox type + comment on SlimNonEmptyBox

* slim_slice: prefix conversions with 'from_'

* slim_slice: use transmute_copy

* add empty LICENSE file

* pacify clippy
2023-11-16 12:51:01 +00:00
Mazdak Farrokhzad c566dbae3d spacetimedb-data-structures: new crate + nstr! (#491)
* spacetimedb-data-structures: new crate + nstr!

* nstr: address review comments
2023-10-30 18:00:54 +00:00