Thorium/Linq.Expression.Optimizer
Thorium/Linq.Expression.Optimizer has 117 GitHub stars and 7 forks. Star changes are not measured yet. Last checked 2026-11-09 05:07 UTC. Last push 2026-11-01.
System.Linq.Expression expressions optimizer. http://thorium.github.io/Linq.Expression.Optimizer
측정된 스타 증가
- in 24h
- 기록 수집 중
- in 7 days
- 기록 수집 중
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
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!
관련 프로젝트 살펴보기
Asabeneh/30-Days-Of-Python
30 Days of Python 프로그래밍 챌린지는 Python 프로그래밍 언어를 30일 동안 배우기 위한 단계별 가이드입니다. 이 챌린지는 100일 이상 걸릴 수 있습니다. 자신의 속도에 맞춰 진행하세요. 다음 동영상도 도움이 될 수 있습니다: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,423 스타grafana/grafana
개방적이고 조합 가능한 옵저버빌리티 및 데이터 시각화 플랫폼입니다. Prometheus, Loki, Elasticsearch, InfluxDB, Postgres 등 여러 소스의 메트릭, 로그, 트레이스를 시각화합니다.
77,763 스타redis/redis
실시간 데이터 기반 애플리케이션을 구축하는 개발자에게 Redis는 가장 선호되고, 가장 빠르며, 기능이 가장 풍부한 캐시, 데이터 구조 서버이자 문서 및 벡터 쿼리 엔진입니다.
77,309 스타apache/superset
Apache Superset는 데이터 시각화 및 데이터 탐색 플랫폼입니다.
75,453 스타