Skip to content

Commit

Permalink
[C#] Mark experimental API (#1769)
Browse files Browse the repository at this point in the history
  • Loading branch information
RReverser authored Sep 30, 2024
1 parent dd52cda commit 8790abd
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using SpacetimeDB;

#pragma warning disable CA1050 // Declare types in namespaces - this is a test fixture, no need for a namespace.
#pragma warning disable STDB_UNSTABLE // Enable experimental SpacetimeDB features

[SpacetimeDB.Type]
public partial struct CustomStruct
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions crates/bindings-csharp/Codegen/Module.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,13 @@ public Scope.Extensions GenerateSchedule()
{
var extensions = new Scope.Extensions(Scope, FullName);

// Mark the API as unstable. We use name `STDB_UNSTABLE` because:
// 1. It's a close equivalent of the `unstable` Cargo feature in Rust.
// 2. Our diagnostic IDs use either BSATN or STDB prefix depending on the package.
// 3. We don't expect to mark individual experimental features with numeric IDs, so we don't use the standard 1234 suffix.
extensions.Contents.Append(
$$"""
[System.Diagnostics.CodeAnalysis.Experimental("STDB_UNSTABLE")]
public static void VolatileNonatomicScheduleImmediate{{Name}}({{string.Join(
", ",
Args.Select(a => $"{a.Type} {a.Name}")
Expand Down

2 comments on commit 8790abd

@github-actions
Copy link

@github-actions github-actions bot commented on 8790abd Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Callgrind benchmark results

Callgrind Benchmark Report

These benchmarks were run using callgrind,
an instruction-level profiler. They allow comparisons between sqlite (sqlite), SpacetimeDB running through a module (stdb_module), and the underlying SpacetimeDB data storage engine (stdb_raw). Callgrind emulates a CPU to collect the below estimates.

Measurement changes larger than five percent are in bold.

In-memory benchmarks

callgrind: empty transaction

db total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw 5397 5397 0.00% 5481 5481 0.00%
sqlite 5555 5555 0.00% 5909 5909 0.00%

callgrind: filter

db schema indices count preload _column data_type total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str no_index 64 128 2 string 117796 117796 0.00% 118326 118270 0.05%
stdb_raw u32_u64_str no_index 64 128 1 u64 75385 75385 0.00% 75687 75687 0.00%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24059 24057 0.01% 24457 24467 -0.04%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23025 23025 0.00% 23383 23383 0.00%
sqlite u32_u64_str no_index 64 128 2 string 144619 144619 0.00% 146199 146203 -0.00%
sqlite u32_u64_str no_index 64 128 1 u64 124007 124007 0.00% 125263 125267 -0.00%
sqlite u32_u64_str btree_each_column 64 128 2 string 134418 134418 0.00% 136074 136074 0.00%
sqlite u32_u64_str btree_each_column 64 128 1 u64 131324 131324 0.00% 132680 132692 -0.01%

callgrind: insert bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 64 128 896948 896556 0.04% 957936 957432 0.05%
stdb_raw u32_u64_str btree_each_column 64 128 1045896 1049395 -0.33% 1117732 1091059 2.44%
sqlite u32_u64_str unique_0 64 128 398156 398156 0.00% 417472 417468 0.00%
sqlite u32_u64_str btree_each_column 64 128 983473 983473 0.00% 1028283 1028279 0.00%

callgrind: iterate

db schema indices count total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 152683 152683 0.00% 152749 152749 0.00%
stdb_raw u32_u64_str unique_0 64 15708 15708 0.00% 15750 15746 0.03%
sqlite u32_u64_str unique_0 1024 1067203 1067203 0.00% 1070493 1070493 0.00%
sqlite u32_u64_str unique_0 64 76149 76149 0.00% 77185 77185 0.00%

callgrind: serialize_product_value

count format total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
64 json 47374 47374 0.00% 49958 49958 0.00%
64 bsatn 25716 25716 0.00% 28028 28028 0.00%
16 json 12126 12126 0.00% 13962 13962 0.00%
16 bsatn 8117 8117 0.00% 9511 9511 0.00%

callgrind: update bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 1024 20621176 20627064 -0.03% 21345152 21357548 -0.06%
stdb_raw u32_u64_str unique_0 64 128 1300657 1301232 -0.04% 1382417 1383064 -0.05%
sqlite u32_u64_str unique_0 1024 1024 1802091 1802091 0.00% 1811199 1811199 0.00%
sqlite u32_u64_str unique_0 64 128 128437 128437 0.00% 131283 131283 0.00%
On-disk benchmarks

callgrind: empty transaction

db total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw 5407 5407 0.00% 5483 5483 0.00%
sqlite 5597 5597 0.00% 6019 6019 0.00%

callgrind: filter

db schema indices count preload _column data_type total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str no_index 64 128 2 string 117806 117806 0.00% 118256 118256 0.00%
stdb_raw u32_u64_str no_index 64 128 1 u64 75395 75395 0.00% 75689 75681 0.01%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24067 24067 0.00% 24457 24457 0.00%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23035 23035 0.00% 23353 23353 0.00%
sqlite u32_u64_str no_index 64 128 2 string 146540 146540 0.00% 148396 148392 0.00%
sqlite u32_u64_str no_index 64 128 1 u64 125928 125928 0.00% 127508 127508 0.00%
sqlite u32_u64_str btree_each_column 64 128 2 string 136540 136540 0.00% 138794 138790 0.00%
sqlite u32_u64_str btree_each_column 64 128 1 u64 133420 133420 0.00% 135350 135354 -0.00%

callgrind: insert bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 64 128 845945 845871 0.01% 906687 906581 0.01%
stdb_raw u32_u64_str btree_each_column 64 128 1000080 997594 0.25% 1072336 1039520 3.16%
sqlite u32_u64_str unique_0 64 128 415693 415693 0.00% 434479 434487 -0.00%
sqlite u32_u64_str btree_each_column 64 128 1021734 1021734 0.00% 1065822 1065814 0.00%

callgrind: iterate

db schema indices count total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 152693 152693 0.00% 152731 152731 0.00%
stdb_raw u32_u64_str unique_0 64 15718 15718 0.00% 15756 15756 0.00%
sqlite u32_u64_str unique_0 1024 1070271 1070271 0.00% 1074019 1074019 0.00%
sqlite u32_u64_str unique_0 64 77921 77921 0.00% 79237 79237 0.00%

callgrind: serialize_product_value

count format total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
64 json 47374 47374 0.00% 49958 49958 0.00%
64 bsatn 25716 25716 0.00% 28028 28028 0.00%
16 json 12126 12126 0.00% 13962 13962 0.00%
16 bsatn 8117 8117 0.00% 9511 9511 0.00%

callgrind: update bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 1024 19323245 19326511 -0.02% 20102671 20108185 -0.03%
stdb_raw u32_u64_str unique_0 64 128 1254241 1254420 -0.01% 1335183 1335244 -0.00%
sqlite u32_u64_str unique_0 1024 1024 1809652 1809652 0.00% 1818204 1818204 0.00%
sqlite u32_u64_str unique_0 64 128 132563 132569 -0.00% 135489 135495 -0.00%

@github-actions
Copy link

@github-actions github-actions bot commented on 8790abd Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Criterion benchmark results

Error when comparing benchmarks:

Caused by:

Please sign in to comment.