Gedcom.Vector 1.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Gedcom.Vector --version 1.3.0
                    
NuGet\Install-Package Gedcom.Vector -Version 1.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Gedcom.Vector" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Gedcom.Vector" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Gedcom.Vector" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Gedcom.Vector --version 1.3.0
                    
#r "nuget: Gedcom.Vector, 1.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Gedcom.Vector@1.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Gedcom.Vector&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Gedcom.Vector&version=1.3.0
                    
Install as a Cake Tool

Gedcom.Vector

A lightening fast, high-performance, zero-dependency, low-allocation C# library for parsing, building, mutating, and exporting GEDCOM genealogy files.

CI License: PolyForm Noncommercial Target: .NET 8.0 Dependencies: Zero


๐Ÿš€ Key Capabilities

Core Engine Fluent Relationship Context Developer Experience
SIMD Tokenizer: .NET 8 SearchValues<char> line splitting. $O(1)$ Relationship Traversal: 298x faster than LINQ scans. Fluent Builder (GedcomBuilder): Strongly-typed tree construction.
Single-Pass Parser: Zero-allocation level-0 streaming reader. $O(1)$ Incremental Mutability: Instant add, update, and delete. Encoding Auto-Detect: UTF-8, UTF-16, ANSEL, ANSI (Windows-1252).
Direct UTF-8 Exporter: Formats byte spans directly (>2.8M records/sec). Span String Pooling: Deduplicates dates, places, and names. Zero Dependencies: Portable, pure C# .NET 8 codebase.

๐Ÿ“ฆ Getting Started

1. Installation

dotnet add package Gedcom.Vector

2. High-Performance Stream Import & Export

Import GEDCOM files directly into memory-optimized record structures (GedcomParseResult), or serialize records directly to streams:

using Gedcom.Vector;

// --- IMPORT ---
using var inputStream = File.OpenRead("family.ged");
var importAdapter = new GedcomImportAdapter();
GedcomParseResult result = importAdapter.Parse(inputStream);

Console.WriteLine($"Parsed {result.Persons.Count} individuals and {result.Families.Count} families.");

// --- EXPORT ---
var exportWriter = new GedcomExportWriter();

// Export directly to file stream (Interpolation-free UTF-8 byte serialization)
using var outputStream = File.Create("output.ged");
exportWriter.Write(result, outputStream);

3. $O(1)$ Relationship Navigation & Tree Mutation (GedcomTreeContext)

Navigating raw GEDCOM collections usually requires writing slow $O(N)$ LINQ queries. Wrapping the result in GedcomTreeContext indexes the tree upon instantiation, enabling $O(1)$ constant-time relationship lookups and $O(1)$ incremental updates:

// Wrap result in an indexed context
GedcomTreeContext tree = result.ToContext();

// 1. O(1) Traversal Queries (53 ns execution time)
PersonRecord? father = tree.GetPerson("@I1@");
foreach (var child in tree.ChildrenOf(father))
{
    Console.WriteLine($"Child: {child.FirstName} {child.LastName}");
}

foreach (var spouse in tree.SpousesOf(father))
{
    Console.WriteLine($"Spouse: {spouse.FirstName} {spouse.LastName}");
}

// 2. O(1) Incremental Tree Mutations (Backing collections automatically kept in sync)
tree.AddPerson(new PersonRecord("@I4@", "Alice", "Doe", PersonSex.Female, null, null, null, null));
tree.DeletePerson("@I1@"); // Father is deleted and unlinked from spouses, children, and media in O(1) time

4. Programmatic Tree Construction (GedcomBuilder)

Construct syntactically valid GEDCOM trees programmatically without manually creating collections or managing cross-references:

using Gedcom.Vector.Builder;

GedcomParseResult result = new GedcomBuilder()
    .AddPerson("@I1@", "John", "Doe", PersonSex.Male)
        .WithBirth("1 JAN 1900", "New York, USA")
        .WithDeath("1 JAN 1980", "Boston, USA")
    .AddPerson("@I2@", "Jane", "Smith", PersonSex.Female)
        .WithBirth("1 JUN 1905")
    .AddFamily("@F1@", "@I1@", "@I2@")
        .WithMarriage("1 JUN 1925", "Chicago, USA")
        .WithChild("@I3@")
    .AddPerson("@I3@", "Bobby", "Doe", PersonSex.Male)
    .Build();

โšก Performance & Benchmarks

Architecture & Benchmark Interfaces:

  • Core Stream Import/Export (MeasureParsing / MeasureExporting): Benchmarks streaming parsing and serialization between raw streams and GedcomParseResult records (non-fluent).
  • Relationship Traversal (QueryChildrenFluent): Benchmarks $O(1)$ relationship queries using the optional indexed GedcomTreeContext.

BenchmarkDotNet metrics evaluated on a dataset of 4,000 individuals (INDI) and 2,000 families (FAM):

1. Core Streaming Import & Export (GedcomParseResult)

Method Mean Execution Time Gen0 Gen1 Gen2 Allocated Memory Throughput
MeasureParsing 3.51 ms 500.00 472.66 210.94 3.06 MB ~1.14M records/sec
MeasureExporting 1.11 ms 746.09 724.61 646.48 4.03 MB >2.8M records/sec

2. Relationship Query Interface Benchmark (LINQ vs Fluent GedcomTreeContext)

Query Interface Method Mean Execution Time StdDev Gen0 Allocated Memory Speedup vs LINQ
QueryChildrenLinq (Raw LINQ Scan) 15,840.57 ns (15.84 ยตs) 257.00 ns 0.0610 664 B 1.0x (Baseline)
QueryChildrenFluent (GedcomTreeContext) 53.19 ns 0.50 ns 0.0181 152 B 298x Faster
CreateTreeContext (One-Time Indexing) 1.14 ms 52.05 ยตs 179.69 1.10 MB (Pays off after 72 queries)

Context Indexing Pay-Off Math: Building GedcomTreeContext takes 1.14 ms for a 4,000-person tree. Because fluent queries execute in 53.19 ns (vs 15.84 ยตs for LINQ), context indexing pays off its entire CPU time cost after just 72 relationship queries.

To execute benchmarks locally:

dotnet run -c Release --project tests/Gedcom.Vector.Benchmarks -- --filter *

๐Ÿ› ๏ธ Technical Reference

Character Encoding Detection

GedcomEncodingDetector automatically selects the target decoder:

Declared CHAR Tag Decoder Used Notes
UTF-8 UTF-8 Standard default
UNICODE UTF-16 LE/BE Identified via Byte Order Mark (BOM)
ANSEL Custom AnselDecoder $O(1)$ zero-allocation combining diacritics decoder
ANSI Windows-1252 Extended Windows Latin-1
(absent) UTF-8 Fallback default

Configuration Options

Option Type Default Description
MaxFileSizeBytes long 52428800 (50 MB) Maximum allowed GEDCOM file size limit in bytes

๐Ÿ“‚ Project Structure & Documentation

gedcom-vector/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ Gedcom.Vector/
โ”‚       โ”œโ”€โ”€ Builder/           # GedcomBuilder, PersonBuilder, FamilyBuilder, MediaBuilder
โ”‚       โ”œโ”€โ”€ Parsing/           # StreamingGedcomParser, GedcomStringPool, AnselDecoder
โ”‚       โ”œโ”€โ”€ GedcomImportAdapter.cs
โ”‚       โ”œโ”€โ”€ GedcomExportWriter.cs
โ”‚       โ”œโ”€โ”€ GedcomEncodingDetector.cs
โ”‚       โ”œโ”€โ”€ GedcomTreeContext.cs
โ”‚       โ””โ”€โ”€ ...
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ Gedcom.Vector.Tests/   # Unit tests (90.4% Line Rate, 84.6% Branch Rate)
โ”‚   โ””โ”€โ”€ Gedcom.Vector.Benchmarks/
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ architecture.md        # Technical Architecture Guide & Pipeline Diagrams
โ”‚   โ””โ”€โ”€ performance_roadmap.md # Performance Roadmap & Historical Benchmarks
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ README.md

For detailed architectural diagrams and deep-dive technical specs, see the Architecture Guide and Performance Roadmap.


๐Ÿ“œ License & Support

Free for non-commercial use under the PolyForm Noncommercial License 1.0.0.

  • Allowed: Personal projects, research, open-source software, non-profit organizations.
  • Commercial Use: Requires a commercial license. Please open an issue to discuss commercial terms.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.2 108 7/22/2026
1.3.1 103 7/22/2026
1.3.0 94 7/21/2026
1.2.3 153 7/21/2026
1.2.2 101 7/21/2026
1.2.1 143 7/21/2026
1.2.0 101 7/21/2026
1.1.1 107 7/13/2026
1.1.0 111 7/12/2026
1.0.0 399 7/12/2026