Class Layout
function table. class B { public: virtual int f1(); virtual void f2(int); virtual int f3(int); ~~~ }; B *bp = new B; 47 B members bp vptr other stuff… &B::f1 &B::f2 &B::f3 vtbl for B B object Copyright object’s virtual function table. The call bp‐>f1(); Is translated to something like (*(bp‐>vptr)[0])(bp) 49 B members bp vptr other stuff… &B::f1 &B::f2 &B::f3 vtbl for B B object Copyright © Copyright © 2020 by Stephen C. Dewhurst and Daniel Saks 23 Virtual Calling Sequence The call bp‐>f1(); Is translated to something like (*(bp‐>vptr)[0])() Or, in other words, MOV R0,R40 码力 | 51 页 | 461.37 KB | 5 月前3Compile-Time Validation
two functions (f1, f2) into a new function. The return value of the previous function is passed to the next function. auto compose(auto f1, auto f2) { return [=] { return f2(f1()); }; }Composition Compose two functions (f1, f2) into a new function. Each function takes a callback to next function as argument. auto compose(auto f1, auto f2) { return [=] (auto next) { return f1([=] () { return individual functions used in its composition. auto f1 = foo | bar; auto f2 = f1 | baz; // pseudocode properties of f2 == compose( properties of f1, properties of baz )Function Composition struct0 码力 | 137 页 | 1.70 MB | 5 月前3Beyond struct: Programming a Struct Replacement in C++20
Google library These opinions are my ownStruct struct person { int id = 1; std::string name; int score = 0; }; int main() { person p{.id = 1, .name = "John"}; p.id = 2; p.name = "JRB"; std::cout << p // member<"id", int>, // member<"score", int, [](auto& self) { return get<"id">(self) + 1; }>, // member<"name", std::string, [] { return // >; Person p; std::cout << get<"id">(p) << " " << get<"name">(p) << " " << get<"score">(p) << "\n"; }Member template()> struct 0 码力 | 65 页 | 702.78 KB | 5 月前3Quantifying Accidental Complexity: An empirical look at teaching and using C++
preserves the arg’s l/rvalue-ness (incl. can move from rvalue arg) C++20 Proposed equivalent 28 void f1(int x) { g(x); } void f2(const X& x) { // for lvalues g(x); } void f2(X&& x) { // for rvalues f3(const T& t) { g(t); } // hard to overload to pass by value // hard to overload for rvalues void f1(in int x) { g(x); } void f2(in X x) { g(x); } templatevoid f3(in T t) { g(t); virtual, some path must have a non-const use of x (else use in) C++20 Proposed equivalent 30 void f1(/*inout*/ X& x) { g(x); // ok x = 42; // ok but can omit } void f2(/*inout*/ X& x) { 0 码力 | 36 页 | 2.68 MB | 5 月前3PingCAP TiDB&TiKV Introduction OLTP
型数据库,大数据的存储刚需不可 避免 • 挑战:基于 Google Spanner/F1 论 文,基础软件最前沿的领域之一,技 术门槛最高 资料来源:公开资料整理 数据库技术发展演进 Google - 大规模分布式计算领域的领跑者 2003 GFS 2004 MapReduce 2006 BigTable 2012 Spanner 2013 F1 BigTable Map Reduce GFS Google 以此为基础打造了Hadoop F1 Data Flow Spanner Colossus Google 内部新一代分布式处理框架,于12/13年发表 相关论文,奠定下一代分布式 NewSQL的理论和工程 实践基石。PingCAP以此为基础打造了TiDB & TiKV HBase Map Reduce HDFS TiDB TiKV NewSQL | TiDB Google Spanner / F1 - The Powered By Jeff Dean 我们在做什么 新一代NewSQL分布式关系型数据库 Ti Project (TiDB + TiKV) ● 基于 2013 年 Google Spanner / F1 论文 ● 基于 2014 年 Stanford 工业级分布式一致性协议实现 Raft 论文 概括: 无限水平线性扩展、高并发高吞吐、跨数据中心多活、MySQL 兼容的真正意义上的分布式数据库 ●0 码力 | 21 页 | 613.54 KB | 5 月前3Data Is All You Need for Fusion
breakPipeline(0); subpipe = pipeline.subpipeline(0, 1); id f d i l( t Afor x { f1(); f2(); } for x { f1(); } — - — Break for y{ f2(); }Controlling Properties of the Fused Code code-samples breakPipeline(0); subpipe = pipeline.subpipeline(0, 1); id f d i l( t A for x { f1(); f2(); } for x { f1(); } — - — Break for y{ f2(); }Controlling Properties of the Fused Code code subpipe = pipeline.subpipeline(0, 1); void my fused impl(const Array a, for x { f1(); f2(); } for x { f1(); — - — Subpipeline for y{ f2(); } } code-samples manya227 June 2024 Pipeline 0 码力 | 151 页 | 9.90 MB | 5 月前3Pipes: How Plumbing Can Make Your C++ Code More Expressive
BRANCHING OUT: FORK fork transform(f1) transform(f2) transform(f3) results1 results2 results3 push_back push_back push_back transform(f)27 fork transform(f1) transform(f2) transform(f3) push_back push_back pipes::transform(f) >>= pipes::fork(pipes::transform(f1) >>= pipes::push_back(results1), pipes::transform(f2) >>= pipes::push_back(results2) push_back results1 set_segregate set_segregate(input1, input2, pipes::transform(f1) >>= pipes::push_back(results1), pipes::filter(p2) >>= pipes::push_back(results2),0 码力 | 61 页 | 9.52 MB | 5 月前3julia 1.10.10
type. "Fast" arrays like NumPy arrays that store elements in-place (i.e., dtype is np.float64, [('f1', np.uint64), ('f2', np.int32)], etc.) can be rep- resented by Array{T} where T is a concrete, immutable states that calling with certain argtypes is a part of public API. For example, the change between f1 and f2 in the example below is usually considered compatible because the change is invisible by the Tuple{Real}, x); julia> f(2) 5 julia> f1(::Integer) = Integer f1(::Real) = Real; julia> f2(x::Real) = _f2(x) _f2(::Integer) = Integer _f2(_) = Real; julia> f1(1) IntegerCHAPTER 41. ESSENTIALS 5690 码力 | 1692 页 | 6.34 MB | 3 月前3Julia 1.10.9
type. "Fast" arrays like NumPy arrays that store elements in-place (i.e., dtype is np.float64, [('f1', np.uint64), ('f2', np.int32)], etc.) can be rep- resented by Array{T} where T is a concrete, immutable states that calling with certain argtypes is a part of public API. For example, the change between f1 and f2 in the example below is usually considered compatible because the change is invisible by the Tuple{Real}, x); julia> f(2) 5 julia> f1(::Integer) = Integer f1(::Real) = Real; julia> f2(x::Real) = _f2(x) _f2(::Integer) = Integer _f2(_) = Real; julia> f1(1) IntegerCHAPTER 41. ESSENTIALS 5690 码力 | 1692 页 | 6.34 MB | 3 月前3COMPOSABLE C++
writes writes code like this? code like this? auto compose(auto f1, auto f2) { return [f1, f2] (auto arg) { if (auto result = f1(arg); result) { return result; } return f2(arg); writes writes code like this? code like this? auto compose(auto f1, auto f2) { return [f1, f2] (auto arg) { if (auto result = f1(arg); result) { return result; } return f2(arg);0 码力 | 124 页 | 8.28 MB | 5 月前3
共 49 条
- 1
- 2
- 3
- 4
- 5