{"id":15411462,"url":"https://github.com/thorium/linq.expression.optimizer","last_synced_at":"2025-05-16T07:00:27.923Z","repository":{"id":60773843,"uuid":"66735844","full_name":"Thorium/Linq.Expression.Optimizer","owner":"Thorium","description":"System.Linq.Expression expressions optimizer. http://thorium.github.io/Linq.Expression.Optimizer","archived":false,"fork":false,"pushed_at":"2025-04-25T10:33:44.000Z","size":431,"stargazers_count":106,"open_issues_count":3,"forks_count":7,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-25T11:39:16.938Z","etag":null,"topics":["boolean-algebra","expression-tree","linq","mathematical-expressions","optimisation","optimization","reduction","sql"],"latest_commit_sha":null,"homepage":"","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Thorium.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-08-27T21:15:30.000Z","updated_at":"2025-04-25T10:33:48.000Z","dependencies_parsed_at":"2024-05-23T09:47:43.161Z","dependency_job_id":"e0749512-30ed-446e-9217-8fdd0f49b79f","html_url":"https://github.com/Thorium/Linq.Expression.Optimizer","commit_stats":{"total_commits":67,"total_committers":5,"mean_commits":13.4,"dds":0.4626865671641791,"last_synced_commit":"aa37ca5b7bc01a293580fb702e70a52a342b7a52"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thorium%2FLinq.Expression.Optimizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thorium%2FLinq.Expression.Optimizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thorium%2FLinq.Expression.Optimizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thorium%2FLinq.Expression.Optimizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Thorium","download_url":"https://codeload.github.com/Thorium/Linq.Expression.Optimizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485025,"owners_count":22078764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boolean-algebra","expression-tree","linq","mathematical-expressions","optimisation","optimization","reduction","sql"],"created_at":"2024-10-01T16:49:10.701Z","updated_at":"2025-05-16T07:00:27.860Z","avatar_url":"https://github.com/Thorium.png","language":"F#","readme":"[![Issue Stats](http://issuestats.com/github/thorium/Linq.Expression.Optimizer/badge/issue)](http://issuestats.com/github/thorium/Linq.Expression.Optimizer)\n[![Issue Stats](http://issuestats.com/github/thorium/Linq.Expression.Optimizer/badge/pr)](http://issuestats.com/github/thorium/Linq.Expression.Optimizer)\n\n# Linq.Expression.Optimizer\n\nLightweight optimizer of System.Linq.Expression expressions. \nJust basic boolean algebra and reductions, constant and tuple/anonymous type eliminations. \nFor side-effect-free Expressions. No compilation-subjective optimizations. \nThis is meant to be used with expressions that are not compiled but transferred to other domains.\n\nSupported frameworks: Net 3.5, Net 4.5-... (and Mono), .NET Standard 1.6 (so also .NET Core)\n\n## Supported optimizations\n\nExample as a quote. There are various other cases also.\n\n- Replace constants comparisons:    ` 3 \u003c 4  -\u003e  true ` \n- Remove anonymous types:    ` new AnonymousObject(Item1 = x, Item2 = \"\").Item1  --\u003e  x `\n- Cut not used condition:    ` if false then x else y  -\u003e  y `\n- Remove not:    ` not(false)  -\u003e  true `\n- Binary tree balancing:   ` a or (b or (c or (d or (e or (f or (g or h)))))) -\u003e ((a or b) or (c or d)) or ((e or f) or (g or h)) `\n- Captured closure constant (\"free variable\") evaluation:   ` y = 3 and (y + x)  -\u003e  (3 + x) `\n- Execute simple math: `5 * 3  -\u003e  15` \n- Boolean algebra reductions:\n  * gather            ` (x or y) and (x or z)   -\u003e  x or (y and z) `  \n  * identity          ` false or y  -\u003e  y `              \n  * annihilate        ` true or x  -\u003e  true `             \n  * absorb            ` x and (x or y)  -\u003e  x `              \n  * idempotence       ` y or y  -\u003e  y `                      \n  * complement        ` x and not(x)  -\u003e  false `            \n  * doubleNegation    ` not(not(y))  -\u003e  y `                 \n  * deMorgan          ` not(x) and not(y)  -\u003e  not(x or y) ` \n\n\n## Background\n\nThis is a side-track from [SQLProvider](https://github.com/fsprojects/SQLProvider), excellent tool that is\nkind of OR-mapper with auto-generated objects, so it compiles any databases to .NET-language, and works\nfast on design time in Visual Studio or other editors.\n\nBut I needed better SQL-queries. So this optimises .NET LINQ-expressions.\nThese expressions were not meant to be compiled, so [Nessos LinqOptimizer](https://github.com/nessos/LinqOptimizer) was not the right tool.\nI thought that .NET would optimize these automatically, but no.\n   \nRead the [Getting started tutorial](http://thorium.github.io/Linq.Expression.Optimizer/index.html#Getting-started) to learn more.\n\nDocumentation: http://thorium.github.io/Linq.Expression.Optimizer\n\n## Maintainer(s)\n\n- [@thorium](https://github.com/thorium)\n\nIf you want more optimizations, please feel free to send PRs!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthorium%2Flinq.expression.optimizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthorium%2Flinq.expression.optimizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthorium%2Flinq.expression.optimizer/lists"}