{"id":481488,"date":"2026-05-29T04:44:04","date_gmt":"2026-05-29T04:44:04","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=481488"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=481488","title":{"rendered":"\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0439 time series \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0440: \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c 10 \u0441\u043e\u0431\u044b\u0442\u0438\u0439\/\u0441\u0435\u043a \u043d\u0430 \u0433\u0440\u0430\u0444\u0435 \u0438\u0437 300k \u0443\u0437\u043b\u043e\u0432"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u044b\u0439 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<ul>\n<li>\n<p><strong>\u0421\u043b\u043e\u0439 0<\/strong> \u2014 \u0441\u044b\u0440\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f: \u0446\u0435\u043d\u0430 \u0442\u0438\u043a\u0430, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043b\u043e\u0439 1<\/strong> \u2014 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u044b \u043f\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c: \u0434\u0435\u043b\u044c\u0442\u0430, \u0433\u0430\u043c\u043c\u0430, \u0441\u043a\u043e\u0440.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043b\u043e\u0439 2<\/strong> \u2014 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u044b \u043f\u043e \u0441\u0435\u043a\u0442\u043e\u0440\u0430\u043c: \u0440\u0438\u0441\u043a \u043d\u0430 \u0441\u0435\u043a\u0442\u043e\u0440, \u043e\u0431\u0449\u0430\u044f \u044d\u043a\u0441\u043f\u043e\u0437\u0438\u0446\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043b\u043e\u0439 3<\/strong> \u2014 \u043f\u043e\u0440\u0442\u0444\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438: VaR, \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u0430\u044f \u043f\u0440\u0438\u0431\u044b\u043b\u044c.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043b\u043e\u0439 4<\/strong> \u2014 enterprise-\u043b\u0438\u043c\u0438\u0442\u044b \u0438 \u0430\u043b\u0435\u0440\u0442\u044b.<\/p>\n<\/li>\n<\/ul>\n<p>\u0428\u0438\u0440\u0438\u043d\u0430 \u0441\u043b\u043e\u044f \u2014 5000 \u0443\u0437\u043b\u043e\u0432. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0451\u0432 \u2014 60. \u041e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0443\u0437\u043b\u043e\u0432 \u2014 300 000.<\/p>\n<p>\u041a\u0430\u0436\u0434\u0443\u044e \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 10 \u043d\u043e\u0432\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 (\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435). \u041d\u0430\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u2014 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0441\u0451 \u0441 \u043d\u0443\u043b\u044f \u2014 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0441\u0435 300 000 \u0443\u0437\u043b\u043e\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435. \u041f\u0440\u0438 10 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u0445 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u044d\u0442\u043e 3 \u043c\u043b\u043d \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0443\u0437\u043b\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u0410 \u0435\u0441\u043b\u0438 \u0448\u0438\u0440\u0438\u043d\u0430 \u0441\u043b\u043e\u044f 100 000 \u0438 \u0441\u043b\u043e\u0451\u0432 100? \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c 10 \u043c\u043b\u043d \u0443\u0437\u043b\u043e\u0432 \u043d\u0430 \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442. \u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043d\u0435 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f.<\/p>\n<p><strong>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0438 \u0438\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f<\/strong><\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u041f\u043e\u0434\u0445\u043e\u0434<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442 (recompute everything)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u042d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u043e\u0441\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u0433\u0440\u0430\u0444\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0422\u0440\u0438\u0433\u0433\u0435\u0440\u044b \u0432 \u0411\u0414<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u044b\u0445 in-memory \u0433\u0440\u0430\u0444\u043e\u0432<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Stream-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b (Flink, Kafka Streams)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0422\u044f\u0436\u0451\u043b\u044b\u0435, \u043d\u0435 \u0434\u043b\u044f in-memory \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0439<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043a\u044d\u0448 \u0438\u043d\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043b\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043b\u0435\u0433\u043a\u043e \u043e\u0448\u0438\u0431\u0438\u0442\u044c\u0441\u044f<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e<\/strong><\/p>\n<ul>\n<li>\n<p>\u0418\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442: \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b\u0435 \u0443\u0437\u043b\u044b, \u0430 \u043d\u0435 \u0432\u0441\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u0432 \u0433\u043e\u0440\u044f\u0447\u0435\u043c \u043f\u0443\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0422\u043e\u0447\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (Fenwick, \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0441\u0443\u043c\u043c\u044b).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0434\u0432\u0443\u0445 \u0440\u0435\u0436\u0438\u043c\u043e\u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f: SetValue (production) \u0438 Mutate (\u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438).<\/p>\n<\/li>\n<\/ul>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435: PhiFlow<\/h3>\n<p>PhiFlow \u2014 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f .NET 8.0+, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0430\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u043b\u043e\u0438\u0441\u0442\u044b\u0445 \u0433\u0440\u0430\u0444\u0430\u0445 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0448\u0438\u0440\u0438\u043d\u044b.<\/p>\n<pre><code class=\"cs\">dotnet add package PhiFlow --version 0.1.3<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0438\u0434\u0435\u0438<\/strong><\/p>\n<ol>\n<li>\n<p><strong>Interval Cone-of-Influence<\/strong> \u2014 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b\u0445 \u0443\u0437\u043b\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u043e\u0435.<\/p>\n<\/li>\n<li>\n<p><strong>\u0424\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0448\u0438\u0440\u0438\u043d\u0430 \u0441\u043b\u043e\u0451\u0432<\/strong> \u2014 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044e \u0438 \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f.<\/p>\n<\/li>\n<li>\n<p><strong>\u0422\u043e\u0447\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b (Fenwick, \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0441\u0443\u043c\u043c\u044b)<\/strong> \u2014 \u0431\u0435\u0437 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u0439 \u0438 \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c\u0438 \u0432\u0440\u043e\u0434\u0435 HyperLogLog.<\/p>\n<\/li>\n<li>\n<p><strong>\u0414\u0432\u0430 \u0440\u0435\u0436\u0438\u043c\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f<\/strong> \u2014 SetValue (\u0437\u0430\u043c\u0435\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f) \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u0438 Mutate (\u0434\u0435\u043b\u044c\u0442\u0430) \u0434\u043b\u044f \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0439.<\/p>\n<\/li>\n<\/ol>\n<h3>\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442<\/h3>\n<h4>\u0428\u0430\u0433 1. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0433\u0440\u0430\u0444\u0430<\/h4>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><code>width<\/code> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u0437\u043b\u043e\u0432 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u043e\u0435.<\/p>\n<\/li>\n<li>\n<p><code>layers<\/code> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0451\u0432.<\/p>\n<\/li>\n<li>\n<p><code>domain<\/code> \u2014 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (0..DomainSize-1).<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cs\">using PhiFlow;int width = 5000;int layers = 60;int domain = 1024;var rt = new PhiFlowRuntime(width, layers, domain);\/\/ \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f: \u0437\u0430\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0441\u0442\u043e \u043f\u043e\u0434 \u0434\u0435\u043b\u044c\u0442\u044brt.Reserve(maxDeltaCount: 16);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u0428\u0430\u0433 2. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432<\/h4>\n<p>\u0418\u043d\u0434\u0435\u043a\u0441\u044b \u0443\u0441\u043a\u043e\u0440\u044f\u044e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b (CountGreater, RangeCount, Sum, TopKSum). \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u0441\u043b\u043e\u044e.<\/p>\n<pre><code class=\"cs\">int lastLayer = layers - 1;\/\/ Fenwick-\u0438\u043d\u0434\u0435\u043a\u0441 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u044b\u0445 CountGreater \u0438 RangeCountrt.AttachIndex(lastLayer, new FenwickCountIndex(domain));\/\/ \u0418\u043d\u0434\u0435\u043a\u0441 \u0434\u043b\u044f \u0441\u0443\u043c\u043c\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439rt.AttachIndex(lastLayer, new SumIndex(width));\/\/ \u0418\u043d\u0434\u0435\u043a\u0441 \u0434\u043b\u044f Top-K \u0447\u0435\u0440\u0435\u0437 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044brt.AttachIndex(lastLayer, new HistogramTopKIndex(domain, width));<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u0428\u0430\u0433 3. \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f<\/h4>\n<p>\u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u043b\u043e\u0439 0 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<pre><code class=\"cs\">var rnd = new Random(1);int[] input = new int[width];for (int i = 0; i &lt; width; i++){    input[i] = rnd.Next(domain);}rt.SetInput(input);rt.BuildAll(kWork: 50); \/\/ \u043f\u043e\u043b\u043d\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u0433\u0440\u0430\u0444\u0430<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u0428\u0430\u0433 4. \u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439<\/h4>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442\u0430 \u0432\u0441\u0435\u0433\u043e \u0433\u0440\u0430\u0444\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0432\u0448\u0438\u0435\u0441\u044f \u0432\u0445\u043e\u0434\u044b.<\/p>\n<pre><code class=\"cs\">var updates = new InputUpdate[]{    new InputUpdate(index: 10, value: 512),    new InputUpdate(index: 123, value: 7),    new InputUpdate(index: 2048, value: 999)};rt.ApplyInputUpdates(updates, kWork: 50);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0441\u0430\u043c\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u0443\u0437\u043b\u044b \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b (Interval Cone-of-Influence), \u0438 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0445.<\/p>\n<h4>\u0428\u0430\u0433 5. \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/h4>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e.<\/p>\n<pre><code class=\"cs\">\/\/ \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0441\u043b\u043e\u0435 &gt; 500long countGt = rt.CountGreater(lastLayer, threshold: 500);\/\/ \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 [100, 200)long rangeCount = rt.RangeCount(lastLayer, loInclusive: 100, hiExclusive: 200);\/\/ \u0421\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043d\u0430 \u0441\u043b\u043e\u0435long sum = rt.Sum(lastLayer);\/\/ \u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435long avg = rt.Avg(lastLayer);\/\/ \u0421\u0443\u043c\u043c\u0430 \u0442\u043e\u043f-50 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439long topKSum = rt.TopKSum(lastLayer, k: 50);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h3>\u041f\u043e\u043b\u043d\u044b\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/h3>\n<pre><code class=\"cs\">using PhiFlow;public class RealTimeAnalyticsPipeline{    private readonly PhiFlowRuntime _runtime;    private readonly int _lastLayer;        public RealTimeAnalyticsPipeline(int width, int layers, int domain)    {        _runtime = new PhiFlowRuntime(width, layers, domain);        _runtime.Reserve(maxDeltaCount: 32);        _lastLayer = layers - 1;                \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438        _runtime.AttachIndex(_lastLayer, new FenwickCountIndex(domain));        _runtime.AttachIndex(_lastLayer, new SumIndex(width));        _runtime.AttachIndex(_lastLayer, new HistogramTopKIndex(domain, width));    }        public void Initialize(int[] initialData)    {        _runtime.SetInput(initialData);        _runtime.BuildAll(kWork: 50);    }        public void ProcessEvents(IEnumerable&lt;InputUpdate&gt; events)    {        var updates = events.ToArray();        _runtime.ApplyInputUpdates(updates, kWork: 50);    }        public AnalyticsSnapshot GetSnapshot()    {        return new AnalyticsSnapshot        {            TotalCount = _runtime.Sum(_lastLayer),            HighThresholdCount = _runtime.CountGreater(_lastLayer, 800),            MidRangeCount = _runtime.RangeCount(_lastLayer, 200, 600),            Top10Sum = _runtime.TopKSum(_lastLayer, 10)        };    }}public class AnalyticsSnapshot{    public long TotalCount { get; set; }    public long HighThresholdCount { get; set; }    public long MidRangeCount { get; set; }    public long Top10Sum { get; set; }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h3>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<h4>1. FinTech: \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0438\u0441\u043a\u0430\u043c\u0438<\/h4>\n<p>4 \u0441\u043b\u043e\u044f: \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u2192 \u0441\u0435\u043a\u0442\u043e\u0440\u0430 \u2192 \u043f\u043e\u0440\u0442\u0444\u0435\u043b\u044c \u2192 enterprise-\u043b\u0438\u043c\u0438\u0442\u044b.<\/p>\n<pre><code class=\"cs\">int width = 10000;  \/\/ 10k \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432int layers = 4;int domain = 100000; \/\/ \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0443\u0440\u043e\u0432\u043d\u0438 \u044d\u043a\u0441\u043f\u043e\u0437\u0438\u0446\u0438\u0438var riskRuntime = new PhiFlowRuntime(width, layers, domain);riskRuntime.AttachIndex(3, new FenwickCountIndex(domain)); \/\/ \u043b\u0438\u043c\u0438\u0442\u044b\/\/ \u041f\u0440\u0438\u0448\u043b\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u044b \u043d\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 42var tickUpdate = new InputUpdate(42, newExposureValue);riskRuntime.ApplyInputUpdates(new[] { tickUpdate }, kWork: 50);\/\/ \u041c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441: \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u043b\u0438 \u043b\u0438\u043c\u0438\u0442?long breachedCount = riskRuntime.CountGreater(2, threshold: 10000);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>2. GameDev: \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044f<\/h4>\n<p>6 \u0441\u043b\u043e\u0451\u0432: \u043d\u0430\u043b\u043e\u0433 \u043f\u0440\u043e\u0432\u0438\u043d\u0446\u0438\u0438 \u2192 \u0434\u043e\u0445\u043e\u0434 \u043f\u0440\u043e\u0432\u0438\u043d\u0446\u0438\u0438 \u2192 \u0441\u0447\u0430\u0441\u0442\u044c\u0435 \u2192 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u2192 \u0432\u043e\u0435\u043d\u043d\u0430\u044f \u0441\u0438\u043b\u0430 \u2192 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0430\u0440\u043c\u0438\u0438.<\/p>\n<pre><code class=\"cs\">int provinces = 5000;int layers = 6;int domain = 1000;var ecoRuntime = new PhiFlowRuntime(provinces, layers, domain);ecoRuntime.AttachIndex(5, new SumIndex(provinces)); \/\/ \u043e\u0431\u0449\u0430\u044f \u0441\u0438\u043b\u0430 \u0430\u0440\u043c\u0438\u0438ecoRuntime.AttachIndex(5, new HistogramTopKIndex(domain, provinces)); \/\/ \u0442\u043e\u043f-\u043f\u0440\u043e\u0432\u0438\u043d\u0446\u0438\u0438\/\/ \u0418\u0433\u0440\u043e\u043a \u043f\u043e\u0432\u044b\u0441\u0438\u043b \u043d\u0430\u043b\u043e\u0433 \u0432 \u043f\u0440\u043e\u0432\u0438\u043d\u0446\u0438\u0438 123ecoRuntime.ApplyInputUpdates(new[] { new InputUpdate(123, 75) }, kWork: 50);\/\/ \u041a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0430\u0441\u044c \u043e\u0431\u0449\u0430\u044f \u0441\u0438\u043b\u0430 \u0430\u0440\u043c\u0438\u0438?long totalArmyPower = ecoRuntime.Sum(5);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>3. IIoT: \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430<\/h4>\n<p>\u0414\u0430\u0442\u0447\u0438\u043a\u0438 \u2192 \u0441\u0442\u0430\u043d\u043a\u0438 \u2192 \u043b\u0438\u043d\u0438\u0438 \u2192 \u0437\u0430\u0432\u043e\u0434\u044b \u2192 \u0440\u0435\u0433\u0438\u043e\u043d.<\/p>\n<pre><code class=\"cs\">int sensors = 20000;int layers = 5;int domain = 4096; \/\/ \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 0..4095var iotRuntime = new PhiFlowRuntime(sensors, layers, domain);iotRuntime.AttachIndex(4, new FenwickCountIndex(domain)); \/\/ \u0430\u043b\u0435\u0440\u0442\u044b \u043f\u043e \u0440\u0435\u0433\u0438\u043e\u043d\u0430\u043c\/\/ \u0414\u0430\u0442\u0447\u0438\u043a 5001 \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u044evar anomalyUpdate = new InputUpdate(5001, 3800);iotRuntime.ApplyInputUpdates(new[] { anomalyUpdate }, kWork: 50);\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0432\u043e\u0434\u043e\u0432 \u0432 \u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u043e\u043d\u0435?long anomalousPlants = iotRuntime.CountGreater(3, threshold: 3500);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>4. AdTech: real-time bidding<\/h4>\n<p>\u0418\u043c\u043f\u0440\u0435\u0441\u0441\u0438\u044f \u2192 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u2192 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u2192 \u043a\u0430\u043c\u043f\u0430\u043d\u0438\u044f \u2192 \u0431\u044e\u0434\u0436\u0435\u0442.<\/p>\n<pre><code class=\"cs\">int users = 100000;int layers = 5;int domain = 100; \/\/ \u0441\u043a\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f 0..99var adRuntime = new PhiFlowRuntime(users, layers, domain);adRuntime.AttachIndex(4, new FenwickCountIndex(domain)); \/\/ \u0431\u044e\u0434\u0436\u0435\u0442\u043d\u044b\u0435 \u043b\u0438\u043c\u0438\u0442\u044b\/\/ \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c 42 \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043b \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044evar conversionUpdate = new InputUpdate(42, 95);adRuntime.ApplyInputUpdates(new[] { conversionUpdate }, kWork: 50);\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u043b\u0438 \u0431\u044e\u0434\u0436\u0435\u0442\u043d\u044b\u0439 \u043f\u043e\u0440\u043e\u0433?long budgetBreached = adRuntime.CountGreater(3, threshold: 80);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h3>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/h3>\n<p>\u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438 \u043d\u0430 <strong>Intel Core i5-11400F, Windows 11, .NET 8.0, BenchmarkDotNet 0.15.8<\/strong>.<\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0433\u0440\u0430\u0444\u0430: \u0448\u0438\u0440\u0438\u043d\u0430 5000, \u0441\u043b\u043e\u0451\u0432 60, \u0434\u043e\u043c\u0435\u043d 1024.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0411\u0435\u0437 PhiFlow (\u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442)<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0421 PhiFlow<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">1 \u0434\u0435\u043b\u044c\u0442\u0430, KWork=50<\/p>\n<\/td>\n<td>\n<p align=\"left\">10.7 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.195 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>~55x<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">4 \u0434\u0435\u043b\u044c\u0442\u044b, KWork=50<\/p>\n<\/td>\n<td>\n<p align=\"left\">10.7 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.75 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>~14x<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">1 \u0434\u0435\u043b\u044c\u0442\u0430, KWork=10<\/p>\n<\/td>\n<td>\n<p align=\"left\">1.8 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.034 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>~53x<\/strong><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>\u0427\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u044d\u0442\u0438 \u0446\u0438\u0444\u0440\u044b:<\/strong><\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438 \u043e\u0434\u043d\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043d\u0435 \u0432\u0441\u0435 300 000 \u0443\u0437\u043b\u043e\u0432, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p>\u0427\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u0435\u043b\u044c\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u0451\u043c\u0430 \u0433\u0440\u0430\u0444\u0430, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u044b\u0438\u0433\u0440\u044b\u0448.<\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u0434\u0435\u043a\u0441\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432: CountGreater, RangeCount, TopKSum \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0437\u0430 O(log domain) \u0438\u043b\u0438 O(1).<\/p>\n<\/li>\n<\/ul>\n<h3>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430\u043c\u0438<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u0425\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430<\/p>\n<\/th>\n<th>\n<p align=\"left\">PhiFlow<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442<\/p>\n<\/th>\n<th>\n<p align=\"left\">Stream processor (Flink)<\/p>\n<\/th>\n<th>\n<p align=\"left\">ClickHouse<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0418\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u2705 (interval cone)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u274c<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u2705<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u274c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0422\u043e\u0447\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u2705<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u274c<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u274c<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u2705 (\u043d\u043e \u043d\u0435 \u0434\u043b\u044f per-event)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">In-memory<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u2705<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u2705<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u274c (Java\/JVM)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u274c (\u0434\u0438\u0441\u043a)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u044b\u0435 \u0433\u0440\u0430\u0444\u044b<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u2705 (\u0440\u043e\u0434\u043d\u043e\u0439)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u274c<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u274c<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u274c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041b\u0430\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0437\u0430\u0432\u0438\u0441\u0438\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b+<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043d\u0438\u0437\u043a\u0430\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0432\u044b\u0441\u043e\u043a\u0430\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043e\u0447\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u043a\u0430\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0441\u0440\u0435\u0434\u043d\u044f\u044f<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0432 \u043f\u0440\u043e\u0435\u043a\u0442<\/h3>\n<p><strong>\u0428\u0430\u0433 1. \u041c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430<\/strong><\/p>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443 \u0432\u0430\u0441 \u0441\u043b\u043e\u0451\u0432 \u0438 \u043a\u0430\u043a\u043e\u0432\u0430 \u0448\u0438\u0440\u0438\u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e. PhiFlow \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0448\u0438\u0440\u0438\u043d\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043b\u043e\u0451\u0432 \u2014 \u044d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044e.<\/p>\n<p><strong>\u0428\u0430\u0433 2. \u0412\u044b\u0431\u043e\u0440 \u0434\u043e\u043c\u0435\u043d\u0430<\/strong><\/p>\n<p>\u0414\u043e\u043c\u0435\u043d \u2014 \u044d\u0442\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (0..DomainSize-1). \u0427\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u043e\u043c\u0435\u043d, \u0442\u0435\u043c \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u0435\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b Fenwick \u0438 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p><strong>\u0428\u0430\u0433 3. \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f runtime<\/strong><\/p>\n<pre><code class=\"cs\">var runtime = new PhiFlowRuntime(width, layers, domain);runtime.Reserve(maxDeltaCount: expectedUpdatesPerBatch);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u0428\u0430\u0433 4. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u043a \u0441\u043b\u043e\u044f\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0430\u0441\u0442\u043e \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0442\u0441\u044f<\/strong><\/p>\n<pre><code class=\"cs\">if (needThresholdQueries)    runtime.AttachIndex(layer, new FenwickCountIndex(domain));if (needSumQueries)    runtime.AttachIndex(layer, new SumIndex(width));if (needTopKQueries)    runtime.AttachIndex(layer, new HistogramTopKIndex(domain, width));<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u0428\u0430\u0433 5. \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<pre><code class=\"cs\">runtime.SetInput(initialData);runtime.BuildAll(kWork: 50); \/\/ 50 \u2014 \u044d\u0432\u0440\u0438\u0441\u0442\u0438\u043a\u0430, \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434 \u0432\u0430\u0448\u0443 \u0442\u043e\u043f\u043e\u043b\u043e\u0433\u0438\u044e<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u0428\u0430\u0433 6. \u041f\u0440\u0438\u0451\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439<\/strong><\/p>\n<pre><code class=\"cs\">void OnInputChanged(int index, int newValue){    var update = new InputUpdate(index, newValue);    runtime.ApplyInputUpdates(new[] { update }, kWork: 50);}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u0428\u0430\u0433 7. \u041c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u044b<\/strong><\/p>\n<pre><code class=\"cs\">public long GetHighRiskCount(int threshold) =&gt;    runtime.CountGreater(riskLayer, threshold);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h3>\u0414\u0432\u0430 \u0440\u0435\u0436\u0438\u043c\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439<\/h3>\n<h4>SetValue (\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f production)<\/h4>\n<p>\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u0437\u043b\u0430 \u043d\u0430 \u043d\u043e\u0432\u043e\u0435.<\/p>\n<pre><code class=\"cs\">var update = new InputUpdate(index: 42, value: 512);runtime.ApplyInputUpdates(new[] { update }, kWork: 50);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>Mutation (\u0434\u043b\u044f \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0439 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f)<\/h4>\n<p>\u0414\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043c\u0443\u0442\u0430\u0446\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u043e\u043b\u0435\u0437\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"cs\">var mutation = new InputMutation(index: 42, delta: +5);runtime.ApplyInputMutations(new[] { mutation }, kWork: 50);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u0411\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/strong> \u2014 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 Community Edition. \u041a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0438.<\/p>\n<h3>\u0413\u0434\u0435 \u0432\u0437\u044f\u0442\u044c<\/h3>\n<p><strong>NuGet:<\/strong> <code>dotnet add package PhiFlow<\/code><\/p>\n<p><strong>GitHub (\u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438):<\/strong> <a href=\"https:\/\/github.com\/likeslines-maker\/PhiFlow\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/likeslines-maker\/PhiFlow<\/a><\/p>\n<p>PhiFlow \u2014 \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043d\u0430 \u0441\u043b\u043e\u0438\u0441\u0442\u044b\u0445 \u0433\u0440\u0430\u0444\u0430\u0445 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0448\u0438\u0440\u0438\u043d\u044b.<\/p>\n<p>\u041e\u043d\u0430 \u0440\u0435\u0448\u0430\u0435\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443: \u043a\u043e\u0433\u0434\u0430 \u0432 \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u044b\u0439 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439, \u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u044b\u0435 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u044b (CountGreater, RangeCount, Sum, TopK) \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u043e\u0435.<\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0435 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0435 stream-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b \u0438\u043b\u0438 OLAP-\u0431\u0430\u0437\u044b. \u041e\u043d\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u0432\u043e\u044e \u043d\u0438\u0448\u0443: in-memory, \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u043d\u044b\u0435 \u043b\u0430\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438, \u0442\u043e\u0447\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u0448 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u0438\u0437 60 \u0441\u043b\u043e\u0451\u0432 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430 10 \u0441\u0435\u043a\u0443\u043d\u0434 \u0432\u043c\u0435\u0441\u0442\u043e 0.2 \u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0447\u0438\u0442\u0430\u043b\u0438 \u043d\u0435 \u0442\u0435\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c.<\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1040918\/\">https:\/\/habr.com\/ru\/articles\/1040918\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u044b\u0439 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.\u0421\u043b\u043e\u0439 0 \u2014 \u0441\u044b\u0440\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f: \u0446\u0435\u043d\u0430 \u0442\u0438\u043a\u0430, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0430.\u0421\u043b\u043e\u0439 1 \u2014 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u044b \u043f\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c: \u0434\u0435\u043b\u044c\u0442\u0430, \u0433\u0430\u043c\u043c\u0430, \u0441\u043a\u043e\u0440.\u0421\u043b\u043e\u0439 2 \u2014 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u044b \u043f\u043e \u0441\u0435\u043a\u0442\u043e\u0440\u0430\u043c: \u0440\u0438\u0441\u043a \u043d\u0430 \u0441\u0435\u043a\u0442\u043e\u0440, \u043e\u0431\u0449\u0430\u044f \u044d\u043a\u0441\u043f\u043e\u0437\u0438\u0446\u0438\u044f.\u0421\u043b\u043e\u0439 3 \u2014 \u043f\u043e\u0440\u0442\u0444\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438: VaR, \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u0430\u044f \u043f\u0440\u0438\u0431\u044b\u043b\u044c.\u0421\u043b\u043e\u0439 4 \u2014 enterprise-\u043b\u0438\u043c\u0438\u0442\u044b \u0438 \u0430\u043b\u0435\u0440\u0442\u044b.\u0428\u0438\u0440\u0438\u043d\u0430 \u0441\u043b\u043e\u044f \u2014 5000 \u0443\u0437\u043b\u043e\u0432. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0451\u0432 \u2014 60. \u041e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0443\u0437\u043b\u043e\u0432 \u2014 300 000.\u041a\u0430\u0436\u0434\u0443\u044e \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 10 \u043d\u043e\u0432\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 (\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435). \u041d\u0430\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u2014 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0441\u0451 \u0441 \u043d\u0443\u043b\u044f \u2014 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0441\u0435 300 000 \u0443\u0437\u043b\u043e\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435. \u041f\u0440\u0438 10 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u0445 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u044d\u0442\u043e 3 \u043c\u043b\u043d \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0443\u0437\u043b\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u0410 \u0435\u0441\u043b\u0438 \u0448\u0438\u0440\u0438\u043d\u0430 \u0441\u043b\u043e\u044f 100 000 \u0438 \u0441\u043b\u043e\u0451\u0432 100? \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c 10 \u043c\u043b\u043d \u0443\u0437\u043b\u043e\u0432 \u043d\u0430 \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442. \u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043d\u0435 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f.\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0438 \u0438\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u041f\u043e\u0434\u0445\u043e\u0434\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442 (recompute everything)\u042d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u043e\u0441\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u0433\u0440\u0430\u0444\u0430\u0422\u0440\u0438\u0433\u0433\u0435\u0440\u044b \u0432 \u0411\u0414\u041d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u044b\u0445 in-memory \u0433\u0440\u0430\u0444\u043e\u0432Stream-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b (Flink, Kafka Streams)\u0422\u044f\u0436\u0451\u043b\u044b\u0435, \u043d\u0435 \u0434\u043b\u044f in-memory \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0439\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043a\u044d\u0448 \u0438\u043d\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438\u0421\u043b\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043b\u0435\u0433\u043a\u043e \u043e\u0448\u0438\u0431\u0438\u0442\u044c\u0441\u044f\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e\u0418\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442: \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b\u0435 \u0443\u0437\u043b\u044b, \u0430 \u043d\u0435 \u0432\u0441\u0435.\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u0432 \u0433\u043e\u0440\u044f\u0447\u0435\u043c \u043f\u0443\u0442\u0438.\u0422\u043e\u0447\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (Fenwick, \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0441\u0443\u043c\u043c\u044b).\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0434\u0432\u0443\u0445 \u0440\u0435\u0436\u0438\u043c\u043e\u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f: SetValue (production) \u0438 Mutate (\u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438).\u0420\u0435\u0448\u0435\u043d\u0438\u0435: PhiFlowPhiFlow \u2014 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f .NET 8.0+, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0430\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u043b\u043e\u0438\u0441\u0442\u044b\u0445 \u0433\u0440\u0430\u0444\u0430\u0445 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0448\u0438\u0440\u0438\u043d\u044b.dotnet add package PhiFlow &#8212;version 0.1.3\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0438\u0434\u0435\u0438Interval Cone-of-Influence \u2014 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b\u0445 \u0443\u0437\u043b\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u043e\u0435.\u0424\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0448\u0438\u0440\u0438\u043d\u0430 \u0441\u043b\u043e\u0451\u0432 \u2014 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044e \u0438 \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f.\u0422\u043e\u0447\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b (Fenwick, \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0441\u0443\u043c\u043c\u044b) \u2014 \u0431\u0435\u0437 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u0439 \u0438 \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c\u0438 \u0432\u0440\u043e\u0434\u0435 HyperLogLog.\u0414\u0432\u0430 \u0440\u0435\u0436\u0438\u043c\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u2014 SetValue (\u0437\u0430\u043c\u0435\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f) \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u0438 Mutate (\u0434\u0435\u043b\u044c\u0442\u0430) \u0434\u043b\u044f \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0439.\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442\u0428\u0430\u0433 1. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0433\u0440\u0430\u0444\u0430\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:width \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u0437\u043b\u043e\u0432 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u043e\u0435.layers \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0451\u0432.domain \u2014 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (0..DomainSize-1).using PhiFlow;int width = 5000;int layers = 60;int domain = 1024;var rt = new PhiFlowRuntime(width, layers, domain);\/\/ \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f: \u0437\u0430\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0441\u0442\u043e \u043f\u043e\u0434 \u0434\u0435\u043b\u044c\u0442\u044brt.Reserve(maxDeltaCount: 16);\u0428\u0430\u0433 2. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432\u0418\u043d\u0434\u0435\u043a\u0441\u044b \u0443\u0441\u043a\u043e\u0440\u044f\u044e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b (CountGreater, RangeCount, Sum, TopKSum). \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u0441\u043b\u043e\u044e.int lastLayer = layers &#8212; 1;\/\/ Fenwick-\u0438\u043d\u0434\u0435\u043a\u0441 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u044b\u0445 CountGreater \u0438 RangeCountrt.AttachIndex(lastLayer, new FenwickCountIndex(domain));\/\/ \u0418\u043d\u0434\u0435\u043a\u0441 \u0434\u043b\u044f \u0441\u0443\u043c\u043c\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439rt.AttachIndex(lastLayer, new SumIndex(width));\/\/ \u0418\u043d\u0434\u0435\u043a\u0441 \u0434\u043b\u044f Top-K \u0447\u0435\u0440\u0435\u0437 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044brt.AttachIndex(lastLayer, new HistogramTopKIndex(domain, width));\u0428\u0430\u0433 3. \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f\u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u043b\u043e\u0439 0 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438.var rnd = new Random(1);int[] input = new int[width];for (int i = 0; i &lt; width; i++){    input[i] = rnd.Next(domain);}rt.SetInput(input);rt.BuildAll(kWork: 50); \/\/ \u043f\u043e\u043b\u043d\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u0433\u0440\u0430\u0444\u0430\u0428\u0430\u0433 4. \u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439\u0412\u043c\u0435\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442\u0430 \u0432\u0441\u0435\u0433\u043e \u0433\u0440\u0430\u0444\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0432\u0448\u0438\u0435\u0441\u044f \u0432\u0445\u043e\u0434\u044b.var updates = new InputUpdate[]{    new InputUpdate(index: 10, value: 512),    new InputUpdate(index: 123, value: 7),    new InputUpdate(index: 2048, value: 999)};rt.ApplyInputUpdates(updates, kWork: 50);\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0441\u0430\u043c\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u0443\u0437\u043b\u044b \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b (Interval Cone-of-Influence), \u0438 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0445.\u0428\u0430\u0433 5. \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e.\/\/ \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0441\u043b\u043e\u0435 &gt; 500long countGt = rt.CountGreater(lastLayer, threshold: 500);\/\/ \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 [100, 200)long rangeCount = rt.RangeCount(lastLayer, loInclusive: 100, hiExclusive: 200);\/\/ \u0421\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043d\u0430 \u0441\u043b\u043e\u0435long sum = rt.Sum(lastLayer);\/\/ \u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435long avg = rt.Avg(lastLayer);\/\/ \u0421\u0443\u043c\u043c\u0430 \u0442\u043e\u043f-50 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439long topKSum = rt.TopKSum(lastLayer, k: 50);\u041f\u043e\u043b\u043d\u044b\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440using PhiFlow;public class RealTimeAnalyticsPipeline{    private readonly PhiFlowRuntime _runtime;    private readonly int _lastLayer;        public RealTimeAnalyticsPipeline(int width, int layers, int domain)    {        _runtime = new PhiFlowRuntime(width, layers, domain);        _runtime.Reserve(maxDeltaCount: 32);        _lastLayer = layers &#8212; 1;                \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438        _runtime.AttachIndex(_lastLayer, new FenwickCountIndex(domain));        _runtime.AttachIndex(_lastLayer, new SumIndex(width));        _runtime.AttachIndex(_lastLayer, new HistogramTopKIndex(domain, width));    }        public void Initialize(int[] initialData)    {        _runtime.SetInput(initialData);        _runtime.BuildAll(kWork: 50);    }        public void ProcessEvents(IEnumerable&lt;InputUpdate&gt; events)    {        var updates = events.ToArray();        _runtime.ApplyInputUpdates(updates, kWork: 50);    }        public AnalyticsSnapshot GetSnapshot()    {        return new AnalyticsSnapshot        {            TotalCount = _runtime.Sum(_lastLayer),            HighThresholdCount = _runtime.CountGreater(_lastLayer, 800),            MidRangeCount = _runtime.RangeCount(_lastLayer, 200, 600),            Top10Sum = _runtime.TopKSum(_lastLayer, 10)        };    }}public class AnalyticsSnapshot{    public long TotalCount { get; set; }    public long HighThresholdCount { get; set; }    public long MidRangeCount { get; set; }    public long Top10Sum { get; set; }}\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f1. FinTech: \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0438\u0441\u043a\u0430\u043c\u04384 \u0441\u043b\u043e\u044f: \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u2192 \u0441\u0435\u043a\u0442\u043e\u0440\u0430 \u2192 \u043f\u043e\u0440\u0442\u0444\u0435\u043b\u044c \u2192 enterprise-\u043b\u0438\u043c\u0438\u0442\u044b.int width = 10000;  \/\/ 10k \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432int layers = 4;int domain = 100000; \/\/ \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0443\u0440\u043e\u0432\u043d\u0438 \u044d\u043a\u0441\u043f\u043e\u0437\u0438\u0446\u0438\u0438var riskRuntime = new PhiFlowRuntime(width, layers, domain);riskRuntime.AttachIndex(3, new FenwickCountIndex(domain)); \/\/ \u043b\u0438\u043c\u0438\u0442\u044b\/\/ \u041f\u0440\u0438\u0448\u043b\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u044b \u043d\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 42var tickUpdate = new InputUpdate(42, newExposureValue);riskRuntime.ApplyInputUpdates(new[] { tickUpdate }, kWork: 50);\/\/ \u041c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441: \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u043b\u0438 \u043b\u0438\u043c\u0438\u0442?long breachedCount = riskRuntime.CountGreater(2, threshold: 10000);2. GameDev: \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044f6 \u0441\u043b\u043e\u0451\u0432: \u043d\u0430\u043b\u043e\u0433 \u043f\u0440\u043e\u0432\u0438\u043d\u0446\u0438\u0438 \u2192 \u0434\u043e\u0445\u043e\u0434 \u043f\u0440\u043e\u0432\u0438\u043d\u0446\u0438\u0438 \u2192 \u0441\u0447\u0430\u0441\u0442\u044c\u0435 \u2192 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u2192 \u0432\u043e\u0435\u043d\u043d\u0430\u044f \u0441\u0438\u043b\u0430 \u2192 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0430\u0440\u043c\u0438\u0438.int provinces = 5000;int layers = 6;int domain = 1000;var ecoRuntime = new PhiFlowRuntime(provinces, layers, domain);ecoRuntime.AttachIndex(5, new SumIndex(provinces)); \/\/ \u043e\u0431\u0449\u0430\u044f \u0441\u0438\u043b\u0430 \u0430\u0440\u043c\u0438\u0438ecoRuntime.AttachIndex(5, new HistogramTopKIndex(domain, provinces)); \/\/ \u0442\u043e\u043f-\u043f\u0440\u043e\u0432\u0438\u043d\u0446\u0438\u0438\/\/ \u0418\u0433\u0440\u043e\u043a \u043f\u043e\u0432\u044b\u0441\u0438\u043b \u043d\u0430\u043b\u043e\u0433 \u0432 \u043f\u0440\u043e\u0432\u0438\u043d\u0446\u0438\u0438 123ecoRuntime.ApplyInputUpdates(new[] { new InputUpdate(123, 75) }, kWork: 50);\/\/ \u041a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0430\u0441\u044c \u043e\u0431\u0449\u0430\u044f \u0441\u0438\u043b\u0430 \u0430\u0440\u043c\u0438\u0438?long totalArmyPower = ecoRuntime.Sum(5);3. IIoT: \u043f\u0440\u0435\u0434\u0438\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430\u0414\u0430\u0442\u0447\u0438\u043a\u0438 \u2192 \u0441\u0442\u0430\u043d\u043a\u0438 \u2192 \u043b\u0438\u043d\u0438\u0438 \u2192 \u0437\u0430\u0432\u043e\u0434\u044b \u2192 \u0440\u0435\u0433\u0438\u043e\u043d.int sensors = 20000;int layers = 5;int domain = 4096; \/\/ \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 0..4095var iotRuntime = new PhiFlowRuntime(sensors, layers, domain);iotRuntime.AttachIndex(4, new FenwickCountIndex(domain)); \/\/ \u0430\u043b\u0435\u0440\u0442\u044b \u043f\u043e \u0440\u0435\u0433\u0438\u043e\u043d\u0430\u043c\/\/ \u0414\u0430\u0442\u0447\u0438\u043a 5001 \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u044evar anomalyUpdate = new InputUpdate(5001, 3800);iotRuntime.ApplyInputUpdates(new[] { anomalyUpdate }, kWork: 50);\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0432\u043e\u0434\u043e\u0432 \u0432 \u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u043e\u043d\u0435?long anomalousPlants = iotRuntime.CountGreater(3, threshold: 3500);4. AdTech: real-time bidding\u0418\u043c\u043f\u0440\u0435\u0441\u0441\u0438\u044f \u2192 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u2192 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u2192 \u043a\u0430\u043c\u043f\u0430\u043d\u0438\u044f \u2192 \u0431\u044e\u0434\u0436\u0435\u0442.int users = 100000;int layers = 5;int domain = 100; \/\/ \u0441\u043a\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f 0..99var adRuntime = new PhiFlowRuntime(users, layers, domain);adRuntime.AttachIndex(4, new FenwickCountIndex(domain)); \/\/ \u0431\u044e\u0434\u0436\u0435\u0442\u043d\u044b\u0435 \u043b\u0438\u043c\u0438\u0442\u044b\/\/ \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c 42 \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043b \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044evar conversionUpdate = new InputUpdate(42, 95);adRuntime.ApplyInputUpdates(new[] { conversionUpdate }, kWork: 50);\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u043b\u0438 \u0431\u044e\u0434\u0436\u0435\u0442\u043d\u044b\u0439 \u043f\u043e\u0440\u043e\u0433?long budgetBreached = adRuntime.CountGreater(3, threshold: 80);\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438 \u043d\u0430 Intel Core i5-11400F, Windows 11, .NET 8.0, BenchmarkDotNet 0.15.8.\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0433\u0440\u0430\u0444\u0430: \u0448\u0438\u0440\u0438\u043d\u0430 5000, \u0441\u043b\u043e\u0451\u0432 60, \u0434\u043e\u043c\u0435\u043d 1024.\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439\u0411\u0435\u0437 PhiFlow (\u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442)\u0421 PhiFlow\u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u04351 \u0434\u0435\u043b\u044c\u0442\u0430, KWork=5010.7 \u04410.195 \u0441~55&#215;4 \u0434\u0435\u043b\u044c\u0442\u044b, KWork=5010.7 \u04410.75 \u0441~14&#215;1 \u0434\u0435\u043b\u044c\u0442\u0430, KWork=101.8 \u04410.034 \u0441~53x\u0427\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u044d\u0442\u0438 \u0446\u0438\u0444\u0440\u044b:\u041f\u0440\u0438 \u043e\u0434\u043d\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043d\u0435 \u0432\u0441\u0435 300 000 \u0443\u0437\u043b\u043e\u0432, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b\u0445.\u0427\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u0435\u043b\u044c\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u0451\u043c\u0430 \u0433\u0440\u0430\u0444\u0430, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u044b\u0438\u0433\u0440\u044b\u0448.\u0418\u043d\u0434\u0435\u043a\u0441\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432: CountGreater, RangeCount, TopKSum \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0437\u0430 O(log domain) \u0438\u043b\u0438 O(1).\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430\u043c\u0438\u0425\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430PhiFlow\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442Stream processor (Flink)ClickHouse\u0418\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0451\u0442\u2705 (interval cone)\u274c\u2705\u274c\u0422\u043e\u0447\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b\u2705\u274c\u274c\u2705 (\u043d\u043e \u043d\u0435 \u0434\u043b\u044f per-event)In-memory\u2705\u2705\u274c (Java\/JVM)\u274c (\u0434\u0438\u0441\u043a)\u041c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u044b\u0435 \u0433\u0440\u0430\u0444\u044b\u2705 (\u0440\u043e\u0434\u043d\u043e\u0439)\u274c\u274c\u274c\u041b\u0430\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u044b\u0437\u0430\u0432\u0438\u0441\u0438\u0442\u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b+\u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f\u043d\u0438\u0437\u043a\u0430\u044f\u0432\u044b\u0441\u043e\u043a\u0430\u044f\u043e\u0447\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u043a\u0430\u044f\u0441\u0440\u0435\u0434\u043d\u044f\u044f\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0428\u0430\u0433 1. \u041c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443 \u0432\u0430\u0441 \u0441\u043b\u043e\u0451\u0432 \u0438 \u043a\u0430\u043a\u043e\u0432\u0430 \u0448\u0438\u0440\u0438\u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e. PhiFlow \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0448\u0438\u0440\u0438\u043d\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043b\u043e\u0451\u0432 \u2014 \u044d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044e.\u0428\u0430\u0433 2. \u0412\u044b\u0431\u043e\u0440 \u0434\u043e\u043c\u0435\u043d\u0430\u0414\u043e\u043c\u0435\u043d \u2014 \u044d\u0442\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (0..DomainSize-1). \u0427\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u043e\u043c\u0435\u043d, \u0442\u0435\u043c \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u0435\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b Fenwick \u0438 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b.\u0428\u0430\u0433 3. \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f runtimevar runtime = new PhiFlowRuntime(width, layers, domain);runtime.Reserve(maxDeltaCount: expectedUpdatesPerBatch);\u0428\u0430\u0433 4. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u043a \u0441\u043b\u043e\u044f\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0430\u0441\u0442\u043e \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0442\u0441\u044fif (needThresholdQueries)    runtime.AttachIndex(layer, new FenwickCountIndex(domain));if (needSumQueries)    runtime.AttachIndex(layer, new SumIndex(width));if (needTopKQueries)    runtime.AttachIndex(layer, new HistogramTopKIndex(domain, width));\u0428\u0430\u0433 5. \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445runtime.SetInput(initialData);runtime.BuildAll(kWork: 50); \/\/ 50 \u2014 \u044d\u0432\u0440\u0438\u0441\u0442\u0438\u043a\u0430, \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434 \u0432\u0430\u0448\u0443 \u0442\u043e\u043f\u043e\u043b\u043e\u0433\u0438\u044e\u0428\u0430\u0433 6. \u041f\u0440\u0438\u0451\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439void OnInputChanged(int index, int newValue){    var update = new InputUpdate(index, newValue);    runtime.ApplyInputUpdates(new[] { update }, kWork: 50);}\u0428\u0430\u0433 7. \u041c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u044bpublic long GetHighRiskCount(int threshold) =&gt;    runtime.CountGreater(riskLayer,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-481488","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/481488","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=481488"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/481488\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=481488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=481488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=481488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}