SlideShare una empresa de Scribd logo
1 de 48
Descargar para leer sin conexión
Writing Allocation Free Code in C#
Matt Ellis
JetBrains
DON’T
YOU DON’T NEED TO DO THIS
UNLESS

YOU ACTUALLY NEED TO DO THIS
MEASURE

MEASURE

MEASURE
WHY?
MANAGED MEMORY IS CHEAP
ALLOCATION IS CHEAP
GARBAGE COLLECTION

IS EXPENSIVE
THROUGHPUT
PEAK MEMORY CAN BE LOW, WHILE MEMORY TRAFFIC IS HUGE
@CITIZENMATT
THROUGHPUT
▸ More allocations mean more garbage collections
▸ Garbage collections introduce pauses
▸ Pauses disrupt throughput
▸ Better throughput means smoother, not (necessarily) faster
▸ Better throughput good for low latency - servers, games, interactive UI, etc.
@CITIZENMATT
CONSTRAINED ENVIRONMENTS
▸ E.g. mobile devices, consoles, etc.
▸ Using less memory is a Good Thing
▸ Less powerful device, GC can be slower
▸ Fewer GCs is better for battery
▸ Throughput again. Mobile gaming is HUGE…
@CITIZENMATT
KNOW YOUR PLATFORM
▸ Even if you don’t use it, you’re using it
▸ Performance has become a key part of the design of the platform. E.g.
▸ C# tuples - System.ValueTuple not System.Tuple
▸ IAsyncEnumerator (await foreach) + ValueTask
▸ Span<T> + slicing
LOW HANGING FRUIT
@CITIZENMATT
LOW HANGING FRUIT
▸ Object reuse. Pass in existing array rather than allocate new one, etc.
▸ String concatenation. Use (and reuse) StringBuilder
▸ params arguments
▸ Boxing
▸ Closures
▸ LINQ
▸ Iterators
▸ async/await
@CITIZENMATT
PARAMS
▸ Unexpected compiler generated allocations
▸ Newer frameworks and compiler use Array.Empty<T>()

@CITIZENMATT
MEASURE!
@CITIZENMATT
BOXING
▸ Passing value type to method expecting a reference type
▸ Creates a new object on the heap (box) that contains a copy of the value type
▸ Any changes to the boxed value do not affect the orginal!
REFERENCE TYPES VS VALUE TYPES
BACK TO BASICS
@CITIZENMATT
REFERENCE TYPES
▸ class keyword
▸ Allocated on heap
▸ A variable for a reference type is a
reference to the thing on the heap
▸ Passed around by reference
▸ Assignment is a copy of the reference,
not the object
▸ struct keyword
▸ Allocated on stack

Or embedded into a reference object
▸ A variable for a value type is the value
itself, e.g. integer
▸ Passed around by value (i.e. copied)
▸ Assignment is a copy of the whole
value
VALUE TYPES
@CITIZENMATT
HEAP VS STACK
▸ The heap is general purpose memory

Lasts for the lifetime of the application
▸ The stack is a block of memory for data required by methods
▸ Each method pushes space onto the stack for local variables
▸ Pops the stack on method exit

Stack allocation is for the lifetime of the method
▸ Value types are the whole data, so live directly on the stack
▸ stackalloc keyword allows creating blocks of memory on the stack
▸ Allocation and cleanup is cheap, but limited
@CITIZENMATT
CLOSURES
▸ Compiler rewrites to capture local variables into class

Lambda rewritten as method on this class
▸ LINQ - static method allocates Enumerator class
▸ Heap allocation viewer can show this
@CITIZENMATT
ITERATORS
▸ Code is rewritten into a state machine
▸ Allocates state machine
@CITIZENMATT
ASYNC / AWAIT
▸ Code is rewritten into a state machine
▸ Allocates state machine + “task method builder”
▸ More allocations for Task and Task<T>

Expensive for common use cases - synchronous return, no reuse, etc.
▸ Can use ValueTask for common use cases

https://blogs.msdn.microsoft.com/dotnet/2018/11/07/understanding-the-whys-whats-and-whens-of-valuetask/
@CITIZENMATT
LOW HANGING FRUIT
▸ Object reuse. Pass in existing array rather than allocate new one, etc.
▸ String concatenation. Use (and reuse) StringBuilder
▸ params arguments - Introduce overload with zero arguments. Or use modern compiler/framework
▸ Boxing - Introduce generic overloads
▸ Closures - Avoid in critical paths. Pass state as argument to lambda. Investigate local functions
▸ LINQ - Avoid in critical paths. Use good old foreach and if
▸ Iterators - Be aware of the cost
▸ async/await - Investigate ValueTask
REFERENCE SEMANTICS

WITH VALUE TYPES
SAY WHAT?
@CITIZENMATT
C# 7.2: REFERENCE SEMANTICS WITH VALUE TYPES
▸ in parameters

Pass value type by reference. Called method cannot modify it
▸ ref locals and ref returns (C# 7.0)
▸ ref readonly returns

Return a read only value type by reference
▸ readonly struct

Immutable value types
▸ ref struct

Stack only value types
WHAT DOES

“REFERENCE SEMANTICS WITH
VALUE TYPES” EVEN MEAN?
Allocating a reference type has a cost, but passing it around is cheap
Allocating a value type is cheap, but passing it around has a cost
Why can’t it be cheap to allocate AND cheap to pass around?
@CITIZENMATT
REFERENCE SEMANTICS WITH VALUE TYPES
▸ Put simply, allows value types to be used like reference types

Pass by reference everywhere
▸ Reduce allocations, reduce copies, reduce memory traffic
▸ Very low level micro-optimisations…

But they’ll be used in the platform…

(And games, and parsing, and serialisation, and…)
@CITIZENMATT
PASS BY REFERENCE / PASS BY VALUE
▸ A variable for a reference type is a
reference to the actual object on the
heap
▸ Passing a reference type to a method
is just passing this reference

The caller and the called method see the same
object on the heap
▸ A variable for a value type is the value
itself
▸ Passing a value type to a method
copies the value
▸ Assigning a value type to a new
variable also copies the value
▸ Original value is unmodified
▸ (Copies aren’t actually that expensive)
@CITIZENMATT
C# 7.0: REF RETURN
▸ Return a reference to value type, not a copy of the value

Return type of method becomes e.g. integer reference - int& in IL
▸ Lifetime of returned value must exceed the lifetime of the called method

E.g. a reference to a field or method argument. NOT a variable in the called method.
▸ Modifying this reference is the same as modifying the original value

E.g. return reference to array cell, and update it
▸ Add ref modifier to method declaration return type, and to return statement
▸ Not allowed on async methods
@CITIZENMATT
C# 7.0: REF LOCAL
▸ Assigning a ref return to a new variable will create a copy

The variable is a value type, not a reference! (Cannot assign int& to int)
▸ A ref local is a variable that is a reference to a value type

Accessing the variable accesses the original value
▸ Use a ref local to store the ref return result
▸ Type inference with var will get the value type, not the ref modifier

Requires ref var to work as expected
DEMO
REF RETURN
@CITIZENMATT
C# 7.2: IN PARAMETERS
▸ Method argument modifier
▸ Complements out and ref
▸ Passed by reference

▸ Method cannot modify original value
▸ Compiler enforces safety with
defensive copy when calling
members
@CITIZENMATT
C# 7.2: REF READONLY RETURN
▸ Extends ref returns and ref locals
▸ Return a value type by reference,

but caller is not allowed to modify

▸ Assign to ref readonly var
▸ Compiler enforces readonly with
errors and defensive copies
@CITIZENMATT
C# 7.2: READONLY STRUCT
▸ in parameters and ref readonly can create defensive copies

The compiler doesn’t know if the struct’s methods will modify state
▸ readonly struct - compiler enforces all fields and properties are readonly
▸ Immutable
▸ More efficient - no copies made when calling members

Improves performance (micro-optimisation)
NO CHANGES TO CLR
@CITIZENMATT
C# 7.2: REF STRUCT
▸ Declare a value type that can only be stack allocated

I.e. can never be part of a reference type
▸ This constrains lifetime to calling method

Also, cannot be boxed, cannot use inside a non-ref struct

Cannot use with async methods or iterators

Cannot be a generic parameter
▸ Limited use cases
▸ Working with stackalloc memory
▸ Primarily for Span<T>
SPAN<T>
@CITIZENMATT
SPAN<T>
▸ New type to unify working with any kind of contiguous memory

Arrays, array segments, strings and substrings, native memory, stackalloc, etc.
▸ Provides array-like API - indexer

ReadOnlySpan<T> provides getter indexer only
▸ Type safe - each element is of type T
▸ Array-like performance

Not quite, but newer runtimes have special support
▸ Slicing

Create a new Span<T> with a sub-section of existing Span
▸ Value Type - struct
▸ System.Memory NuGet package

.NET Standard 1.1 (.NET Framework 4.5)+
▸ New APIs and overloads in the BCL

E.g. Stream.ReadAsync(), Utf8Parser.TryParse()
▸ Span<T>, ReadOnlySpan<T>, Memory<T>
▸ Two versions - “portable” and “fast”

Fast requires runtime support
@CITIZENMATT
SPAN<T> IMPLEMENTATION
@CITIZENMATT
SPAN<T> PERFORMANCE - PORTABLE IMPLEMENTATION
▸ Portable works on .NET Standard 1.1 and above

.NET Framework 4.5+
▸ Portable is not slow!

But not as fast as arrays
▸ Three fields - object reference, internal offset and length

Slightly larger than fast version, dereferencing is slightly more complex operation
@CITIZENMATT
SPAN<T> PERFORMANCE - FAST IMPLEMENTATION
▸ Fast requires runtime support

.NET Core 2.1
▸ Only has two fields - “byref” internal pointer and length

Slightly smaller struct and accessing an element is slightly simpler operation
▸ Specific JIT optimisations

E.g. eliding bounds check in loop, like arrays
▸ Very close to array performance
@CITIZENMATT
WHAT DOES THIS HAVE TO DO WITH REF STRUCT?
▸ For thread safety, need to update all fields of Span<T> atomically (tearing)

Whole point is performance - cannot use synchronisation
▸ Internal pointers require special GC tracking

Too many in flight at once is expensive
▸ How could Span<T> represent stackalloc memory is Span<T> was on the heap?
▸ Solution: Span<T> is a ref struct - can only be created on the stack

Constrained lifetime, single thread access
DEMO
SPAN<T>
@CITIZENMATT
LINKS
▸ Reference semantics with value types

https://docs.microsoft.com/en-us/dotnet/csharp/reference-semantics-with-value-types
▸ Channel 9 - C# 7.2: Understanding Span<T> - Jared Parsons

https://channel9.msdn.com/Events/Connect/2017/T125
▸ Adam Sitnik’s Span<T> post (July 13, 2017)

http://adamsitnik.com/Span/
▸ RyuJIT optimisations for Span<T>

https://blogs.msdn.microsoft.com/dotnet/2017/10/16/ryujit-just-in-time-compiler-optimization-enhancements/
▸ Understanding the whys, whats and whens of ValueTask

https://blogs.msdn.microsoft.com/dotnet/2018/11/07/understanding-the-whys-whats-and-whens-of-valuetask/

Más contenido relacionado

La actualidad más candente

Dronecodeの概要とROSの対応について
Dronecodeの概要とROSの対応についてDronecodeの概要とROSの対応について
Dronecodeの概要とROSの対応について博宣 今村
 
Implementing WebAuthn & FAPI supports on Keycloak
Implementing WebAuthn & FAPI supports on KeycloakImplementing WebAuthn & FAPI supports on Keycloak
Implementing WebAuthn & FAPI supports on KeycloakYuichi Nakamura
 
Django 製 CMS Wagtail で Blog を作ってみる
Django 製 CMS Wagtail で Blog を作ってみるDjango 製 CMS Wagtail で Blog を作ってみる
Django 製 CMS Wagtail で Blog を作ってみるIosif Takakura
 
番組宣伝に関するAbemaTV分析事例の紹介
番組宣伝に関するAbemaTV分析事例の紹介番組宣伝に関するAbemaTV分析事例の紹介
番組宣伝に関するAbemaTV分析事例の紹介cyberagent
 
あれから2年、オープンソースによる ドローン開発はここまで来た!
あれから2年、オープンソースによるドローン開発はここまで来た!あれから2年、オープンソースによるドローン開発はここまで来た!
あれから2年、オープンソースによる ドローン開発はここまで来た!博宣 今村
 
PHP初心者セッション2023 〜ChatGPT時代の簡単な始め方〜
PHP初心者セッション2023 〜ChatGPT時代の簡単な始め方〜PHP初心者セッション2023 〜ChatGPT時代の簡単な始め方〜
PHP初心者セッション2023 〜ChatGPT時代の簡単な始め方〜Hideo Kashioka
 
Spring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Spring Boot to Quarkus: A real app migration experience | DevNation Tech TalkSpring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Spring Boot to Quarkus: A real app migration experience | DevNation Tech TalkRed Hat Developers
 
OPC UAをオープンソースやフリーのソフトで遊んでみた
OPC UAをオープンソースやフリーのソフトで遊んでみたOPC UAをオープンソースやフリーのソフトで遊んでみた
OPC UAをオープンソースやフリーのソフトで遊んでみたミソジ
 
Wireshark入門(4)
Wireshark入門(4)Wireshark入門(4)
Wireshark入門(4)彰 村地
 
Delphi - Howto Threads
Delphi - Howto ThreadsDelphi - Howto Threads
Delphi - Howto ThreadsNiall Munro
 
【Unite Tokyo 2019】AWS for Unity Developers
【Unite Tokyo 2019】AWS for Unity Developers【Unite Tokyo 2019】AWS for Unity Developers
【Unite Tokyo 2019】AWS for Unity DevelopersUnityTechnologiesJapan002
 
Gorush: A push notification server written in Go
Gorush: A push notification server written in GoGorush: A push notification server written in Go
Gorush: A push notification server written in GoBo-Yi Wu
 
階層的決定性ウォレットを理解しよう
階層的決定性ウォレットを理解しよう階層的決定性ウォレットを理解しよう
階層的決定性ウォレットを理解しようbitbank, Inc. Tokyo, Japan
 
FAPI (Financial-grade API) and CIBA (Client Initiated Backchannel Authenticat...
FAPI (Financial-grade API) and CIBA (Client Initiated Backchannel Authenticat...FAPI (Financial-grade API) and CIBA (Client Initiated Backchannel Authenticat...
FAPI (Financial-grade API) and CIBA (Client Initiated Backchannel Authenticat...Tatsuo Kudo
 
YAPC::Tokyo 2013 ritou OpenID Connect
YAPC::Tokyo 2013 ritou OpenID ConnectYAPC::Tokyo 2013 ritou OpenID Connect
YAPC::Tokyo 2013 ritou OpenID ConnectRyo Ito
 
.NET Web プログラミングにおける非同期 IO のすべて (Build Insider OFFLINE)
.NET Web プログラミングにおける非同期 IO のすべて (Build Insider OFFLINE).NET Web プログラミングにおける非同期 IO のすべて (Build Insider OFFLINE)
.NET Web プログラミングにおける非同期 IO のすべて (Build Insider OFFLINE)Tusyoshi Matsuzaki
 
3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)
3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)
3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)Kuniyasu Suzaki
 
【入門編】 ”はじめてのKong” APIゲートウェイとService Meshについて学ぼう!
【入門編】 ”はじめてのKong” APIゲートウェイとService Meshについて学ぼう! 【入門編】 ”はじめてのKong” APIゲートウェイとService Meshについて学ぼう!
【入門編】 ”はじめてのKong” APIゲートウェイとService Meshについて学ぼう! Junji Nishihara
 
継承やめろマジやめろ。 なぜイケないのか 解説する
継承やめろマジやめろ。 なぜイケないのか 解説する継承やめろマジやめろ。 なぜイケないのか 解説する
継承やめろマジやめろ。 なぜイケないのか 解説するTaishiYamada1
 
SES2020 IoTアーキテクチャ・デザインパターン
SES2020 IoTアーキテクチャ・デザインパターンSES2020 IoTアーキテクチャ・デザインパターン
SES2020 IoTアーキテクチャ・デザインパターンHironori Washizaki
 

La actualidad más candente (20)

Dronecodeの概要とROSの対応について
Dronecodeの概要とROSの対応についてDronecodeの概要とROSの対応について
Dronecodeの概要とROSの対応について
 
Implementing WebAuthn & FAPI supports on Keycloak
Implementing WebAuthn & FAPI supports on KeycloakImplementing WebAuthn & FAPI supports on Keycloak
Implementing WebAuthn & FAPI supports on Keycloak
 
Django 製 CMS Wagtail で Blog を作ってみる
Django 製 CMS Wagtail で Blog を作ってみるDjango 製 CMS Wagtail で Blog を作ってみる
Django 製 CMS Wagtail で Blog を作ってみる
 
番組宣伝に関するAbemaTV分析事例の紹介
番組宣伝に関するAbemaTV分析事例の紹介番組宣伝に関するAbemaTV分析事例の紹介
番組宣伝に関するAbemaTV分析事例の紹介
 
あれから2年、オープンソースによる ドローン開発はここまで来た!
あれから2年、オープンソースによるドローン開発はここまで来た!あれから2年、オープンソースによるドローン開発はここまで来た!
あれから2年、オープンソースによる ドローン開発はここまで来た!
 
PHP初心者セッション2023 〜ChatGPT時代の簡単な始め方〜
PHP初心者セッション2023 〜ChatGPT時代の簡単な始め方〜PHP初心者セッション2023 〜ChatGPT時代の簡単な始め方〜
PHP初心者セッション2023 〜ChatGPT時代の簡単な始め方〜
 
Spring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Spring Boot to Quarkus: A real app migration experience | DevNation Tech TalkSpring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Spring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
 
OPC UAをオープンソースやフリーのソフトで遊んでみた
OPC UAをオープンソースやフリーのソフトで遊んでみたOPC UAをオープンソースやフリーのソフトで遊んでみた
OPC UAをオープンソースやフリーのソフトで遊んでみた
 
Wireshark入門(4)
Wireshark入門(4)Wireshark入門(4)
Wireshark入門(4)
 
Delphi - Howto Threads
Delphi - Howto ThreadsDelphi - Howto Threads
Delphi - Howto Threads
 
【Unite Tokyo 2019】AWS for Unity Developers
【Unite Tokyo 2019】AWS for Unity Developers【Unite Tokyo 2019】AWS for Unity Developers
【Unite Tokyo 2019】AWS for Unity Developers
 
Gorush: A push notification server written in Go
Gorush: A push notification server written in GoGorush: A push notification server written in Go
Gorush: A push notification server written in Go
 
階層的決定性ウォレットを理解しよう
階層的決定性ウォレットを理解しよう階層的決定性ウォレットを理解しよう
階層的決定性ウォレットを理解しよう
 
FAPI (Financial-grade API) and CIBA (Client Initiated Backchannel Authenticat...
FAPI (Financial-grade API) and CIBA (Client Initiated Backchannel Authenticat...FAPI (Financial-grade API) and CIBA (Client Initiated Backchannel Authenticat...
FAPI (Financial-grade API) and CIBA (Client Initiated Backchannel Authenticat...
 
YAPC::Tokyo 2013 ritou OpenID Connect
YAPC::Tokyo 2013 ritou OpenID ConnectYAPC::Tokyo 2013 ritou OpenID Connect
YAPC::Tokyo 2013 ritou OpenID Connect
 
.NET Web プログラミングにおける非同期 IO のすべて (Build Insider OFFLINE)
.NET Web プログラミングにおける非同期 IO のすべて (Build Insider OFFLINE).NET Web プログラミングにおける非同期 IO のすべて (Build Insider OFFLINE)
.NET Web プログラミングにおける非同期 IO のすべて (Build Insider OFFLINE)
 
3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)
3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)
3種類のTEE比較(Intel SGX, ARM TrustZone, RISC-V Keystone)
 
【入門編】 ”はじめてのKong” APIゲートウェイとService Meshについて学ぼう!
【入門編】 ”はじめてのKong” APIゲートウェイとService Meshについて学ぼう! 【入門編】 ”はじめてのKong” APIゲートウェイとService Meshについて学ぼう!
【入門編】 ”はじめてのKong” APIゲートウェイとService Meshについて学ぼう!
 
継承やめろマジやめろ。 なぜイケないのか 解説する
継承やめろマジやめろ。 なぜイケないのか 解説する継承やめろマジやめろ。 なぜイケないのか 解説する
継承やめろマジやめろ。 なぜイケないのか 解説する
 
SES2020 IoTアーキテクチャ・デザインパターン
SES2020 IoTアーキテクチャ・デザインパターンSES2020 IoTアーキテクチャ・デザインパターン
SES2020 IoTアーキテクチャ・デザインパターン
 

Similar a Matt Ellis "Writing Allocation Free Code in C#"

CIlib 2.0: Rethinking Implementation
CIlib 2.0: Rethinking ImplementationCIlib 2.0: Rethinking Implementation
CIlib 2.0: Rethinking ImplementationGary Pamparà
 
Lecture: Refactoring
Lecture: RefactoringLecture: Refactoring
Lecture: RefactoringMarcus Denker
 
codingtechniques1.ppt
codingtechniques1.pptcodingtechniques1.ppt
codingtechniques1.pptazida3
 
Efficient Query Processing in Web Search Engines
Efficient Query Processing in Web Search EnginesEfficient Query Processing in Web Search Engines
Efficient Query Processing in Web Search EnginesSimon Lia-Jonassen
 
The Best Feature of Go – A 5 Year Retrospective
The Best Feature of Go – A 5 Year RetrospectiveThe Best Feature of Go – A 5 Year Retrospective
The Best Feature of Go – A 5 Year RetrospectiveTahir Hashmi
 
Discussion of NGRX-Entity
Discussion of NGRX-EntityDiscussion of NGRX-Entity
Discussion of NGRX-EntityNate Kidwell
 
VCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxVCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxskilljiolms
 
Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Rasan Samarasinghe
 
Game Programming 04 - Style & Design Principles
Game Programming 04 - Style & Design PrinciplesGame Programming 04 - Style & Design Principles
Game Programming 04 - Style & Design PrinciplesNick Pruehs
 
War between Tools and Design 2016
War between Tools and Design 2016War between Tools and Design 2016
War between Tools and Design 2016Mark Windholtz
 
Apache Cassandra, part 2 – data model example, machinery
Apache Cassandra, part 2 – data model example, machineryApache Cassandra, part 2 – data model example, machinery
Apache Cassandra, part 2 – data model example, machineryAndrey Lomakin
 
A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.Jason Hearne-McGuiness
 
GraphQL And Relay Modern
GraphQL And Relay ModernGraphQL And Relay Modern
GraphQL And Relay ModernBrad Pillow
 
GraphQL And Relay Modern
GraphQL And Relay ModernGraphQL And Relay Modern
GraphQL And Relay ModernBrad Pillow
 

Similar a Matt Ellis "Writing Allocation Free Code in C#" (20)

CIlib 2.0: Rethinking Implementation
CIlib 2.0: Rethinking ImplementationCIlib 2.0: Rethinking Implementation
CIlib 2.0: Rethinking Implementation
 
Lecture: Refactoring
Lecture: RefactoringLecture: Refactoring
Lecture: Refactoring
 
codingtechniques1.ppt
codingtechniques1.pptcodingtechniques1.ppt
codingtechniques1.ppt
 
Java performance
Java performanceJava performance
Java performance
 
Efficient Query Processing in Web Search Engines
Efficient Query Processing in Web Search EnginesEfficient Query Processing in Web Search Engines
Efficient Query Processing in Web Search Engines
 
The Best Feature of Go – A 5 Year Retrospective
The Best Feature of Go – A 5 Year RetrospectiveThe Best Feature of Go – A 5 Year Retrospective
The Best Feature of Go – A 5 Year Retrospective
 
Generics
GenericsGenerics
Generics
 
Discussion of NGRX-Entity
Discussion of NGRX-EntityDiscussion of NGRX-Entity
Discussion of NGRX-Entity
 
VCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxVCE Unit 01 (1).pptx
VCE Unit 01 (1).pptx
 
Introduction to C#
Introduction to C#Introduction to C#
Introduction to C#
 
Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++
 
Game Programming 04 - Style & Design Principles
Game Programming 04 - Style & Design PrinciplesGame Programming 04 - Style & Design Principles
Game Programming 04 - Style & Design Principles
 
War between Tools and Design 2016
War between Tools and Design 2016War between Tools and Design 2016
War between Tools and Design 2016
 
Apache Cassandra, part 2 – data model example, machinery
Apache Cassandra, part 2 – data model example, machineryApache Cassandra, part 2 – data model example, machinery
Apache Cassandra, part 2 – data model example, machinery
 
A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.
 
Generics programming in Swift
Generics programming in SwiftGenerics programming in Swift
Generics programming in Swift
 
Query processing System
Query processing SystemQuery processing System
Query processing System
 
VB.net
VB.netVB.net
VB.net
 
GraphQL And Relay Modern
GraphQL And Relay ModernGraphQL And Relay Modern
GraphQL And Relay Modern
 
GraphQL And Relay Modern
GraphQL And Relay ModernGraphQL And Relay Modern
GraphQL And Relay Modern
 

Más de Fwdays

"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y..."How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...Fwdays
 
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil TopchiiFwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro SpodaretsFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"Distributed graphs and microservices in Prom.ua", Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua", Maksym KindritskyiFwdays
 
"Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl..."Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl...Fwdays
 
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T..."How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...Fwdays
 
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ..."The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...Fwdays
 
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu..."[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...Fwdays
 
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care..."[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...Fwdays
 
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"..."4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...Fwdays
 
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout", Anast...
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout",  Anast..."Reconnecting with Purpose: Rediscovering Job Interest after Burnout",  Anast...
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout", Anast...Fwdays
 
"Mentoring 101: How to effectively invest experience in the success of others...
"Mentoring 101: How to effectively invest experience in the success of others..."Mentoring 101: How to effectively invest experience in the success of others...
"Mentoring 101: How to effectively invest experience in the success of others...Fwdays
 
"Mission (im) possible: How to get an offer in 2024?", Oleksandra Myronova
"Mission (im) possible: How to get an offer in 2024?",  Oleksandra Myronova"Mission (im) possible: How to get an offer in 2024?",  Oleksandra Myronova
"Mission (im) possible: How to get an offer in 2024?", Oleksandra MyronovaFwdays
 
"Why have we learned how to package products, but not how to 'package ourselv...
"Why have we learned how to package products, but not how to 'package ourselv..."Why have we learned how to package products, but not how to 'package ourselv...
"Why have we learned how to package products, but not how to 'package ourselv...Fwdays
 
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin..."How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...Fwdays
 

Más de Fwdays (20)

"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y..."How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
 
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"Distributed graphs and microservices in Prom.ua", Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua", Maksym Kindritskyi
 
"Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl..."Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl...
 
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T..."How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
 
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ..."The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
 
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu..."[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
 
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care..."[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
 
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"..."4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
 
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout", Anast...
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout",  Anast..."Reconnecting with Purpose: Rediscovering Job Interest after Burnout",  Anast...
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout", Anast...
 
"Mentoring 101: How to effectively invest experience in the success of others...
"Mentoring 101: How to effectively invest experience in the success of others..."Mentoring 101: How to effectively invest experience in the success of others...
"Mentoring 101: How to effectively invest experience in the success of others...
 
"Mission (im) possible: How to get an offer in 2024?", Oleksandra Myronova
"Mission (im) possible: How to get an offer in 2024?",  Oleksandra Myronova"Mission (im) possible: How to get an offer in 2024?",  Oleksandra Myronova
"Mission (im) possible: How to get an offer in 2024?", Oleksandra Myronova
 
"Why have we learned how to package products, but not how to 'package ourselv...
"Why have we learned how to package products, but not how to 'package ourselv..."Why have we learned how to package products, but not how to 'package ourselv...
"Why have we learned how to package products, but not how to 'package ourselv...
 
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin..."How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
 

Último

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Último (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Matt Ellis "Writing Allocation Free Code in C#"

  • 1. Writing Allocation Free Code in C# Matt Ellis JetBrains
  • 3. YOU DON’T NEED TO DO THIS
  • 10. THROUGHPUT PEAK MEMORY CAN BE LOW, WHILE MEMORY TRAFFIC IS HUGE
  • 11. @CITIZENMATT THROUGHPUT ▸ More allocations mean more garbage collections ▸ Garbage collections introduce pauses ▸ Pauses disrupt throughput ▸ Better throughput means smoother, not (necessarily) faster ▸ Better throughput good for low latency - servers, games, interactive UI, etc.
  • 12. @CITIZENMATT CONSTRAINED ENVIRONMENTS ▸ E.g. mobile devices, consoles, etc. ▸ Using less memory is a Good Thing ▸ Less powerful device, GC can be slower ▸ Fewer GCs is better for battery ▸ Throughput again. Mobile gaming is HUGE…
  • 13. @CITIZENMATT KNOW YOUR PLATFORM ▸ Even if you don’t use it, you’re using it ▸ Performance has become a key part of the design of the platform. E.g. ▸ C# tuples - System.ValueTuple not System.Tuple ▸ IAsyncEnumerator (await foreach) + ValueTask ▸ Span<T> + slicing
  • 15. @CITIZENMATT LOW HANGING FRUIT ▸ Object reuse. Pass in existing array rather than allocate new one, etc. ▸ String concatenation. Use (and reuse) StringBuilder ▸ params arguments ▸ Boxing ▸ Closures ▸ LINQ ▸ Iterators ▸ async/await
  • 17. ▸ Newer frameworks and compiler use Array.Empty<T>()
 @CITIZENMATT MEASURE!
  • 18. @CITIZENMATT BOXING ▸ Passing value type to method expecting a reference type ▸ Creates a new object on the heap (box) that contains a copy of the value type ▸ Any changes to the boxed value do not affect the orginal!
  • 19. REFERENCE TYPES VS VALUE TYPES BACK TO BASICS
  • 20. @CITIZENMATT REFERENCE TYPES ▸ class keyword ▸ Allocated on heap ▸ A variable for a reference type is a reference to the thing on the heap ▸ Passed around by reference ▸ Assignment is a copy of the reference, not the object ▸ struct keyword ▸ Allocated on stack
 Or embedded into a reference object ▸ A variable for a value type is the value itself, e.g. integer ▸ Passed around by value (i.e. copied) ▸ Assignment is a copy of the whole value VALUE TYPES
  • 21. @CITIZENMATT HEAP VS STACK ▸ The heap is general purpose memory
 Lasts for the lifetime of the application ▸ The stack is a block of memory for data required by methods ▸ Each method pushes space onto the stack for local variables ▸ Pops the stack on method exit
 Stack allocation is for the lifetime of the method ▸ Value types are the whole data, so live directly on the stack ▸ stackalloc keyword allows creating blocks of memory on the stack ▸ Allocation and cleanup is cheap, but limited
  • 22. @CITIZENMATT CLOSURES ▸ Compiler rewrites to capture local variables into class
 Lambda rewritten as method on this class ▸ LINQ - static method allocates Enumerator class ▸ Heap allocation viewer can show this
  • 23. @CITIZENMATT ITERATORS ▸ Code is rewritten into a state machine ▸ Allocates state machine
  • 24. @CITIZENMATT ASYNC / AWAIT ▸ Code is rewritten into a state machine ▸ Allocates state machine + “task method builder” ▸ More allocations for Task and Task<T>
 Expensive for common use cases - synchronous return, no reuse, etc. ▸ Can use ValueTask for common use cases
 https://blogs.msdn.microsoft.com/dotnet/2018/11/07/understanding-the-whys-whats-and-whens-of-valuetask/
  • 25. @CITIZENMATT LOW HANGING FRUIT ▸ Object reuse. Pass in existing array rather than allocate new one, etc. ▸ String concatenation. Use (and reuse) StringBuilder ▸ params arguments - Introduce overload with zero arguments. Or use modern compiler/framework ▸ Boxing - Introduce generic overloads ▸ Closures - Avoid in critical paths. Pass state as argument to lambda. Investigate local functions ▸ LINQ - Avoid in critical paths. Use good old foreach and if ▸ Iterators - Be aware of the cost ▸ async/await - Investigate ValueTask
  • 28. @CITIZENMATT C# 7.2: REFERENCE SEMANTICS WITH VALUE TYPES ▸ in parameters
 Pass value type by reference. Called method cannot modify it ▸ ref locals and ref returns (C# 7.0) ▸ ref readonly returns
 Return a read only value type by reference ▸ readonly struct
 Immutable value types ▸ ref struct
 Stack only value types
  • 29. WHAT DOES
 “REFERENCE SEMANTICS WITH VALUE TYPES” EVEN MEAN?
  • 30. Allocating a reference type has a cost, but passing it around is cheap Allocating a value type is cheap, but passing it around has a cost Why can’t it be cheap to allocate AND cheap to pass around?
  • 31. @CITIZENMATT REFERENCE SEMANTICS WITH VALUE TYPES ▸ Put simply, allows value types to be used like reference types
 Pass by reference everywhere ▸ Reduce allocations, reduce copies, reduce memory traffic ▸ Very low level micro-optimisations…
 But they’ll be used in the platform…
 (And games, and parsing, and serialisation, and…)
  • 32. @CITIZENMATT PASS BY REFERENCE / PASS BY VALUE ▸ A variable for a reference type is a reference to the actual object on the heap ▸ Passing a reference type to a method is just passing this reference
 The caller and the called method see the same object on the heap ▸ A variable for a value type is the value itself ▸ Passing a value type to a method copies the value ▸ Assigning a value type to a new variable also copies the value ▸ Original value is unmodified ▸ (Copies aren’t actually that expensive)
  • 33. @CITIZENMATT C# 7.0: REF RETURN ▸ Return a reference to value type, not a copy of the value
 Return type of method becomes e.g. integer reference - int& in IL ▸ Lifetime of returned value must exceed the lifetime of the called method
 E.g. a reference to a field or method argument. NOT a variable in the called method. ▸ Modifying this reference is the same as modifying the original value
 E.g. return reference to array cell, and update it ▸ Add ref modifier to method declaration return type, and to return statement ▸ Not allowed on async methods
  • 34. @CITIZENMATT C# 7.0: REF LOCAL ▸ Assigning a ref return to a new variable will create a copy
 The variable is a value type, not a reference! (Cannot assign int& to int) ▸ A ref local is a variable that is a reference to a value type
 Accessing the variable accesses the original value ▸ Use a ref local to store the ref return result ▸ Type inference with var will get the value type, not the ref modifier
 Requires ref var to work as expected
  • 36. @CITIZENMATT C# 7.2: IN PARAMETERS ▸ Method argument modifier ▸ Complements out and ref ▸ Passed by reference
 ▸ Method cannot modify original value ▸ Compiler enforces safety with defensive copy when calling members
  • 37. @CITIZENMATT C# 7.2: REF READONLY RETURN ▸ Extends ref returns and ref locals ▸ Return a value type by reference,
 but caller is not allowed to modify
 ▸ Assign to ref readonly var ▸ Compiler enforces readonly with errors and defensive copies
  • 38. @CITIZENMATT C# 7.2: READONLY STRUCT ▸ in parameters and ref readonly can create defensive copies
 The compiler doesn’t know if the struct’s methods will modify state ▸ readonly struct - compiler enforces all fields and properties are readonly ▸ Immutable ▸ More efficient - no copies made when calling members
 Improves performance (micro-optimisation)
  • 40. @CITIZENMATT C# 7.2: REF STRUCT ▸ Declare a value type that can only be stack allocated
 I.e. can never be part of a reference type ▸ This constrains lifetime to calling method
 Also, cannot be boxed, cannot use inside a non-ref struct
 Cannot use with async methods or iterators
 Cannot be a generic parameter ▸ Limited use cases ▸ Working with stackalloc memory ▸ Primarily for Span<T>
  • 42. @CITIZENMATT SPAN<T> ▸ New type to unify working with any kind of contiguous memory
 Arrays, array segments, strings and substrings, native memory, stackalloc, etc. ▸ Provides array-like API - indexer
 ReadOnlySpan<T> provides getter indexer only ▸ Type safe - each element is of type T ▸ Array-like performance
 Not quite, but newer runtimes have special support ▸ Slicing
 Create a new Span<T> with a sub-section of existing Span
  • 43. ▸ Value Type - struct ▸ System.Memory NuGet package
 .NET Standard 1.1 (.NET Framework 4.5)+ ▸ New APIs and overloads in the BCL
 E.g. Stream.ReadAsync(), Utf8Parser.TryParse() ▸ Span<T>, ReadOnlySpan<T>, Memory<T> ▸ Two versions - “portable” and “fast”
 Fast requires runtime support @CITIZENMATT SPAN<T> IMPLEMENTATION
  • 44. @CITIZENMATT SPAN<T> PERFORMANCE - PORTABLE IMPLEMENTATION ▸ Portable works on .NET Standard 1.1 and above
 .NET Framework 4.5+ ▸ Portable is not slow!
 But not as fast as arrays ▸ Three fields - object reference, internal offset and length
 Slightly larger than fast version, dereferencing is slightly more complex operation
  • 45. @CITIZENMATT SPAN<T> PERFORMANCE - FAST IMPLEMENTATION ▸ Fast requires runtime support
 .NET Core 2.1 ▸ Only has two fields - “byref” internal pointer and length
 Slightly smaller struct and accessing an element is slightly simpler operation ▸ Specific JIT optimisations
 E.g. eliding bounds check in loop, like arrays ▸ Very close to array performance
  • 46. @CITIZENMATT WHAT DOES THIS HAVE TO DO WITH REF STRUCT? ▸ For thread safety, need to update all fields of Span<T> atomically (tearing)
 Whole point is performance - cannot use synchronisation ▸ Internal pointers require special GC tracking
 Too many in flight at once is expensive ▸ How could Span<T> represent stackalloc memory is Span<T> was on the heap? ▸ Solution: Span<T> is a ref struct - can only be created on the stack
 Constrained lifetime, single thread access
  • 48. @CITIZENMATT LINKS ▸ Reference semantics with value types
 https://docs.microsoft.com/en-us/dotnet/csharp/reference-semantics-with-value-types ▸ Channel 9 - C# 7.2: Understanding Span<T> - Jared Parsons
 https://channel9.msdn.com/Events/Connect/2017/T125 ▸ Adam Sitnik’s Span<T> post (July 13, 2017)
 http://adamsitnik.com/Span/ ▸ RyuJIT optimisations for Span<T>
 https://blogs.msdn.microsoft.com/dotnet/2017/10/16/ryujit-just-in-time-compiler-optimization-enhancements/ ▸ Understanding the whys, whats and whens of ValueTask
 https://blogs.msdn.microsoft.com/dotnet/2018/11/07/understanding-the-whys-whats-and-whens-of-valuetask/