Skip to main content
Glama
orneryd

M.I.M.I.R - Multi-agent Intelligent Memory & Insight Repository

by orneryd
regex_benchmark_test.go2.15 kB
package cypher import ( "context" "testing" "github.com/orneryd/nornicdb/pkg/storage" ) // BenchmarkCreateConstraint benchmarks CREATE CONSTRAINT parsing func BenchmarkCreateConstraint(b *testing.B) { store := storage.NewMemoryEngine() exec := NewStorageExecutor(store) ctx := context.Background() cypher := "CREATE CONSTRAINT node_id_unique IF NOT EXISTS FOR (n:Node) REQUIRE n.id IS UNIQUE" b.ResetTimer() for i := 0; i < b.N; i++ { exec.executeCreateConstraint(ctx, cypher) } } // BenchmarkCreateIndex benchmarks CREATE INDEX parsing func BenchmarkCreateIndex(b *testing.B) { store := storage.NewMemoryEngine() exec := NewStorageExecutor(store) ctx := context.Background() cypher := "CREATE INDEX user_email IF NOT EXISTS FOR (n:User) ON (n.email)" b.ResetTimer() for i := 0; i < b.N; i++ { exec.executeCreateIndex(ctx, cypher) } } // BenchmarkCreateVectorIndex benchmarks CREATE VECTOR INDEX parsing func BenchmarkCreateVectorIndex(b *testing.B) { store := storage.NewMemoryEngine() exec := NewStorageExecutor(store) ctx := context.Background() cypher := `CREATE VECTOR INDEX embedding_idx IF NOT EXISTS FOR (n:Document) ON (n.embedding) OPTIONS {indexConfig: {` + "`vector.dimensions`" + `: 1024, ` + "`vector.similarity_function`" + `: 'cosine'}}` b.ResetTimer() for i := 0; i < b.N; i++ { exec.executeCreateVectorIndex(ctx, cypher) } } // BenchmarkParseDuration benchmarks ISO 8601 duration parsing func BenchmarkParseDuration(b *testing.B) { durations := []string{ "P1Y", "P1M", "P1D", "PT1H", "PT1M", "PT1S", "P1Y2M3D", "PT4H5M6S", "P1Y2M3DT4H5M6S", "P1Y2M3DT4H5M6.789S", } b.ResetTimer() for i := 0; i < b.N; i++ { for _, d := range durations { parseDuration(d) } } } // BenchmarkFulltextQueryParsing benchmarks fulltext query phrase extraction func BenchmarkFulltextQueryParsing(b *testing.B) { queries := []string{ `simple query`, `"exact phrase"`, `word1 "phrase one" word2 "phrase two"`, `complex AND query OR "multiple phrases" NOT excluded`, } b.ResetTimer() for i := 0; i < b.N; i++ { for _, q := range queries { parseFulltextQuery(q) } } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/orneryd/Mimir'

If you have feedback or need assistance with the MCP directory API, please join our Discord server