From Eager Futures/Promises to Lazy Continuations: Evolving an Actor Library Based on Lessons Learned
From Eager Futures/Promises to Lazy Continuations Evolving an Actor Library Based on Lessons Learned from Large-Scale Deployments Benjamin Hindman @benh CppCon 2021prologue ● past life at UC Continuation{std::move(url), std::move(body), std::move(k)}; }lazy continuations auto k = http::Post(url, body, /* k' */); ● resulting type is the “computational graph”lazy continuations auto k = http::Post(url, body body, /* k' */); k.Start(); ● resulting type is the “computational graph” ● the graph is lazy, i.e., nothing has started when we get it (tradeoff for dynamic allocation) and must be explicitly startedlazy0 码力 | 264 页 | 588.96 KB | 5 月前3Applicative: The Forgotten Functional Pattern
}; return fmap(l, f, b); } 51A FUNDAMENTAL ISSUE A FUNDAMENTAL ISSUE Haskell is lazy by default. Haskell is lazy by default. C++ is not. C++ is not. To get around this and still be declarative, To 52TAKE 2.5 TAKE 2.5 return fmap(l, lazy_call(foo, i), lazy_call(bar, i)); templateauto lazy_call(F &&f, Args &&...args) { return lazy{[&] { return std::invoke(std::forward (f) d (f), std::forward (args)...); }}; } 53TAKE 2.5 TAKE 2.5 template struct lazy { F f{}; std::invoke_result_t opt{}; constexpr explicit(true) operator bool() { opt 0 码力 | 141 页 | 11.33 MB | 5 月前3Django 3.0.x Documentation
handling Models Templates Files Form submission django.urls utility functions reverse() reverse_lazy() resolve() get_script_prefix() django.urls functions for use in URLconfs path() re_path() include() future. The initial QuerySet (q1) is unaffected by the refinement process. QuerySets are lazy QuerySets are lazy – the act of creating a QuerySet doesn’t involve any database activity. You can stack filters QuerySet evaluation To avoid performance problems, it is important to understand: that QuerySets are lazy. when they are evaluated. how the data is held in memory. Understand cached attributes As well0 码力 | 3085 页 | 2.95 MB | 1 年前3The Idris Tutorial Version 0.11
To achieve this, Idris provides a Lazy data type, which allows evaluation to be suspended: data Lazy : Type -> Type where Delay : (val : a) -> Lazy a Force : Lazy a -> a 14 Chapter 3. Types and Functions 0.10.3 A value of type Lazy a is unevaluated until it is forced by Force. The Idris type checker knows about the Lazy type, and inserts conversions where necessary between Lazy a and a, and vice versa write ifThenElse as follows, without any explicit use of Force or Delay: ifThenElse : Bool -> Lazy a -> Lazy a -> a; ifThenElse True t e = t; ifThenElse False t e = e; 3.8 Useful Data Types Idris includes0 码力 | 71 页 | 314.20 KB | 1 年前3The Idris Tutorial Version 0.9.20.1
this, Idris provides a Lazy data type, which allows evaluation to be suspended: data Lazy : Type -> Type where Delay : (val : a) -> Lazy a Force : Lazy a -> a A value of type Lazy a is unevaluated until until it is forced by Force. The Idris type checker knows about the Lazy type, and inserts conversions where necessary between Lazy a and a, and vice versa. We can therefore write ifThenElse as follows, without any explicit use of Force or Delay: ifThenElse : Bool -> Lazy a -> Lazy a -> a; ifThenElse True t e = t; ifThenElse False t e = e; 3.8 Useful Data Types Idris includes a number of useful data0 码力 | 71 页 | 316.18 KB | 1 年前3Thinking Functionally In C++
ingredient.add(Mash(banana)); return ingredient; }); }Lazy Evaluation Part 4:Lazy Evaluation Delay actions or calculations until they are needed class Data { public: if(SomeCondition(maybeNeededData.GetType())) { return; } UseData(maybeNeededData.GetBuffer()); }Lazy Evaluation: Allocation Delay actions or calculations until they are needed class Data { public: if(SomeCondition(maybeNeededData.GetType())) { return; } UseData(maybeNeededData.GetBuffer()); }Lazy Evaluation: Fetch data lazily std::vectorMap::GetCitiesInBoundary(LatLonBounds boundary) 0 码力 | 114 页 | 3.14 MB | 5 月前3The Idris Tutorial Version 0.9.18
this, Idris provides a Lazy data type, which allows evaluation to be suspended: data Lazy : Type -> Type where Delay : (val : a) -> Lazy a Force : Lazy a -> a A value of type Lazy a is unevaluated until until it is forced by Force. The Idris type checker knows about the Lazy type, and inserts conversions where necessary between Lazy a and a, and vice versa. We can therefore write ifThenElse as follows, without any explicit use of Force or Delay: ifThenElse : Bool -> Lazy a -> Lazy a -> a; ifThenElse True t e = t; ifThenElse False t e = e; 3.8 Useful Data Types Idris includes a number of useful data0 码力 | 69 页 | 316.20 KB | 1 年前3Spring Framework 2.5.6 Changelog
multiple specified object names * added "allowEagerInit" property to MBeanExporter, for autodetecting lazy-init beans and FactoryBean-produced objects * added "environment" property to MBeanClientInterceptor fail with a descriptive exception if incompatible * Portlet AbstractCommandController falls back to lazy command creation if session timed out after action phase * ByteArray/StringMultipartFileEditor do null on shutdown, allowing for smooth reinitialization * DefaultMessageListenerContainer performs lazy setup in case of any connection exception (also JNDI lookup failure) * DefaultMessageListenerContainer0 码力 | 106 页 | 302.13 KB | 1 年前3Spring Framework 2.5.6 Changelog
multiple specified object names * added "allowEagerInit" property to MBeanExporter, for autodetecting lazy-init beans and FactoryBean-produced objects * added "environment" property to MBeanClientInterceptor fail with a descriptive exception if incompatible * Portlet AbstractCommandController falls back to lazy command creation if session timed out after action phase * ByteArray/StringMultipartFileEditor do null on shutdown, allowing for smooth reinitialization * DefaultMessageListenerContainer performs lazy setup in case of any connection exception (also JNDI lookup failure) * DefaultMessageListenerContainer0 码力 | 106 页 | 305.07 KB | 1 年前3Spring Framework 2.5.5 Changelog
null on shutdown, allowing for smooth reinitialization * DefaultMessageListenerContainer performs lazy setup in case of any connection exception (also JNDI lookup failure) * DefaultMessageListenerContainer page compatibility) * HandlerMethodInvoker does not eagerly copy entire model Map in order to avoid lazy initialization of attribute values * Servlet AnnotationMethodHandlerAdapter throws ambiguity exception qualifiers and primary flag in equals comparison * AbstractAutowireCapableBeanFactory's handling of lazy-init singletons is thread- safe again * AbstractAutowireCapableBeanFactory only invokes "predictBeanType"0 码力 | 101 页 | 291.00 KB | 1 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100