mirror of
https://github.com/hanzoai/graph.git
synced 2026-10-30 18:35:37 +00:00
Derived from Dgraph (github.com/dgraph-io/dgraph) at commit 64804bd2, Apache-2.0. See NOTICE. WHAT THIS IS. The graph engine as a Go library: posting lists, the DQL parser, the type and tokenizer system, the index and schema layers, and the wire types. 39,170 lines of the upstream's 166,337. THE STORE is github.com/luxfi/zapdb, a Badger fork that kept the package name, the subpackages (options, pb, y) and the API — Open, OpenManaged, DB, Options — so the 74 import sites are aliased rather than rewritten. THE CODEC is ZAP. zapdb serializes with ZAP, not protobuf: its pb package builds the ZAP types by default and the protobuf ones only under `-tags grpc`, a path that does not compile (table/builder.go calls pb.Marshal, which that tag removes). One call site in posting needed converting; every other type here is Hanzo's own protobuf and is untouched. NO TRANSPORT. An embedded engine dials nothing, so nothing here imports google.golang.org/grpc. Removed: 20 transport functions in x, the generated service stubs for Raft, Zero and Worker (1,657 lines), and the JWT helper — identity belongs to IAM. The core called none of them. NOT KEPT: worker, conn, raftwal, the cluster commands, the GraphQL layer and the test harnesses. `query`, the DQL execution engine, went with them because it depends on worker; parsing DQL is available here, executing it is not. The history of the upstream project lives at github.com/dgraph-io/dgraph. This repository begins at the derivation because three quarters of that history describes code this fork does not carry.
Comparing the old and new methods, we find that using slice makes the parsing 20% faster on average than using channels. Also, using slices allows the parser to backtrack and peek the tokens which couldn't be done using channels as each token can only be consumed once.
Name unit Old New Improvement
----------------------------------------------------------------------
Benchmark_Filters-4 ns/op 14007 9634 31 %
Benchmark_Geq-4 ns/op 11701 8602 26 %
Benchmark_Date-4 ns/op 11687 8630 26 %
Benchmark_directors-4 ns/op 18663 14201 23 %
Benchmark_Filters_parallel-4 ns/op 6486 5015 22 %
Benchmark_Movies-4 ns/op 16097 12807 20 %
Benchmark_directors_parallel-4 ns/op 8766 6966 20 %
Benchmark_Mutation-4 ns/op 5167 4155 19 %
Benchmark_Movies_parallel-4 ns/op 7537 6151 18 %
Benchmark_Date_parallel-4 ns/op 5462 4515 17 %
Benchmark_Geq_parallel-4 ns/op 5390 4485 16 %
Benchmark_Mutation_parallel-4 ns/op 2326 2161 07 %
Benchmark_Mutation1000-4 ns/op 549428 512851 06 %
Benchmark_Mutation1000_parallel-4 ns/op 261785 254911 02 %