Thorium/Linq.Expression.Optimizer
Thorium/Linq.Expression.Optimizer has 117 GitHub stars and 7 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-13 00:18 UTC. Last push 2026-11-01.
Comment ces chiffres sont mesurés
System.Linq.Expression expressions optimizer. http://thorium.github.io/Linq.Expression.Optimizer
Progression mesurée des étoiles
- in 24h
- 0
- in 7 days
- Historique en cours
- in 15 days
- Historique en cours
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalLinq.Expression.Optimizer
Lightweight optimizer of System.Linq.Expression expressions. Just basic boolean algebra and reductions, constant and tuple/anonymous type eliminations. For side-effect-free Expressions. No compilation-subjective optimizations. This is meant to be used with expressions that are not compiled but transferred to other domains.
Supported frameworks: Net 3.5, Net 4.5-... (and Mono), .NET Standard 1.6 (so also .NET Core)
Supported optimizations
Example as a quote. There are various other cases also.
- Replace constants comparisons:
3 < 4 -> true - Remove anonymous types:
new AnonymousObject(Item1 = x, Item2 = "").Item1 --> x - Cut not used condition:
if false then x else y -> y - Remove not:
not(false) -> true - Binary tree balancing:
a or (b or (c or (d or (e or (f or (g or h)))))) -> ((a or b) or (c or d)) or ((e or f) or (g or h)) - Captured closure constant ("free variable") evaluation:
y = 3 and (y + x) -> (3 + x) - Execute simple math:
5 * 3 -> 15 - Boolean algebra reductions:
- gather
(x or y) and (x or z) -> x or (y and z) - identity
false or y -> y - annihilate
true or x -> true - absorb
x and (x or y) -> x - idempotence
y or y -> y - complement
x and not(x) -> false - doubleNegation
not(not(y)) -> y - deMorgan
not(x) and not(y) -> not(x or y)
- gather
Background
This is a side-track from SQLProvider, excellent tool that is kind of OR-mapper with auto-generated objects, so it compiles any databases to .NET-language, and works fast on design time in Visual Studio or other editors.
But I needed better SQL-queries. So this optimises .NET LINQ-expressions. These expressions were not meant to be compiled, so Nessos LinqOptimizer was not the right tool. I thought that .NET would optimize these automatically, but no.
Read the Getting started tutorial to learn more.
Documentation: http://thorium.github.io/Linq.Expression.Optimizer
Tests
tests/Linq.Expression.Optimizer.Tests is the example-based suite over LINQ queries.
tests/Linq.Expression.Optimizer.PropertyTests is an FsCheck suite over random expression
trees (booleans, integers, doubles with NaN, nullable integers and strings over ten
parameters, in the shapes every reduction rule is written for): the optimized tree
compiles to the same function as the original on a grid of inputs, optimizing never throws,
optimizing twice is optimizing once, the tree never grows, and every reduction rule fires
on some generated tree. An exception the original would throw (x / 0, null.Length) may
disappear when the subtree that threw it is optimized away - the library is for
side-effect-free expressions - but a value never changes and no new exception appears.
Maintainer(s)
If you want more optimizations, please feel free to send PRs!
Explorer des projets similaires
Asabeneh/30-Days-Of-Python
Le défi de programmation 30 Days of Python est un guide pas à pas pour apprendre le langage de programmation Python en 30 jours. Ce défi peut prendre plus de 100 jours. Avancez à votre rythme. Ces vidéos peuvent aussi vous aider : https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,618 étoilesgrafana/grafana
Plateforme ouverte et composable d’observabilité et de visualisation de données. Visualise les métriques, les journaux et les traces issus de plusieurs sources, comme Prometheus, Loki, Elasticsearch, InfluxDB, Postgres et bien d’autres.
77,859 étoilesredis/redis
Pour les développeurs qui créent des applications en temps réel pilotées par les données, Redis est le cache, le serveur de structures de données et le moteur de requêtes documentaires et vectorielles préféré, le plus rapide et le plus riche en fonctionnalités.
77,472 étoilesapache/superset
Apache Superset est une plateforme de visualisation et d'exploration de données.
75,495 étoiles