SlideShare a Scribd company logo
PERSISTENT DATA
STRUCTURES
@IvanVergiliev
ABOUT ME
• Currently - Backend @ Heap
• Real-time music recommendations @ SoundCloud
• Google, Facebook, Leanplum, Chaos Group
• Bronze medal @ IOI ’09
INTERNATIONAL OLYMPIAD IN
INFORMATICS
What do IOI people have in common?
IOI PEOPLE CARE ABOUT PERF
And also, algorithms and data structures
… and lots of other things
I CARE ABOUT PERF, TOO
– Functional Programming @ Universities
“Oh, just try to understand the concept.”
CPU
Abstract
ideas
ENTER
PERSISTENT DATA
STRUCTURES
WHAT’S NEXT
1. Types of Persistent Data Structures
2. Applications
3. Implementation and performance considerations
TYPES OF PERSISTENT DATA
STRUCTURES
EPHEMERAL DATA
STRUCTURES
Or, what most programmers call simply
“data structures”
PARTIALLY
PERSISTENT
DS
You can look,
but you can’t edit
PARTIALLY PERSISTENT DS
PARTIALLY PERSISTENT DS
FULLY
PERSISTENT
DS
Now with branching!
CONFLUENTLY PERSISTENT DS
DAG = Directed Acyclic Graph
CONFLUENTLY PERSISTENT DS
Now with merge support!
APPLICATIONS
AVOIDING SIDE EFFECTS
MULTITHREADING
TRANSACTION ROLLBACK
void addCustomer(List<int> customerIds, int id) {
try (transaction.start()) {
customerIds.add(id);
transaction.commit()
} catch (RollbackException e) {
// ???
}
}
TRANSACTION ROLLBACK
void addCustomer(List<int> customerIds, int id) {
try (transaction.start()) {
customerIds.add(id);
transaction.commit()
} catch (RollbackException e) {
customerIds.pop_back(); // what if we had 10
objects?
}
}
TRANSACTION ROLLBACK
List<int> addCustomer(List<int> customerIds, int id)
{
try (transaction.start()) {
val newCustomersIds = customerIds.add(id);
transaction.commit()
return newCustomersIds;
} catch (RollbackException e) {
return customerIds;
}
}
(Of course, that’s kinda obvious at a functional
programming conference…)
OPTIMISTIC UI
Optimizing user perception instead of
performance
Image source: https://uxplanet.org/optimistic-1000-34d9eefe4c05
OPTIMISTIC UI
• People hate waiting
• API calls almost always succeed
• => just pretend they succeeded and update UI
• However, failures do occur sometimes
HANDLING FAILURE WITH
FULLY PERSISTENT DS
val speculativeState = state
.update('list1', state.get('list2').get(0))
.remove('list2', 0)
display(speculativeState);
api
.saveState(speculativeState)
.onError(=> display(state));
WHAT IF THE SERVER KNOWS
SOMETHING WE DON’T?
Say, someone shot us in Quake
CONFLUENTLY PERSISTENT DS
val speculativeState = state
.update('list1', state.get('list2').get(0))
.remove('list2', 0)
display(speculativeState);
api
.saveState(speculativeState)
.onSuccess((serverState) =>
newState = merge(
serverState,
speculativeState));
.onError(=> display(state));
POSTGRES MVCC
Speaking about transactions…
POSTGRES MVCC
• MVCC ~~= when modifying a row, create a new
version instead of modifying in-place
• Arrays, etc. need to be copied every single time
UNDO AND BROWSING HISTORY
GEOMETRIC PROBLEMS
Time is just another dimension
POINT LOCATION
Or, how your browser determines where you
clicked
POINT LOCATION
Split vertically at intersections
POINT LOCATION
Each vertical split is ordered
POINT LOCATION -
ATTACK PLAN
1. Split map into vertical
stripes at intersections
2. Create a BST for each
stripe
3. Do a binary search to
find the stripe
4. Locate the region in the
BST
HOWEVER, N BINARY TREES =
O(N^2) MEMORY
DELTA BETWEEN TREES IS
LIMITED
DELTA BETWEEN TREES IS
LIMITED
USE PERSISTENT BINARY
SEARCH TREES
TIME
Y
IMPLEMENTATION AND
PERFORMANCE
CONSIDERATIONS
DEALING WITH OLD NODES
YOU REALLY WANT GARBAGE
COLLECTION
• Otherwise…
• reference counting (e.g. C++ shared_ptr<T>)
• now, each node is mutable
• we need synchronization
• destruction can be very slow and cause stack
overflows
WHY 32 SLOTS PER NODE?
Source: http://hypirion.com/
WHY ARE BINARY SEARCH
TREES BINARY?
• Why not 1000-way search trees?
• logN N = 1, so why not?
• Because we need to be able to search and insert
• Complexities are not really O(logk N)
• Search: O(log k * logk N)
• Insert: O(k * logk N)
1000-WAY SEARCH TREE
• Each node would need to support efficient insertion
of elements and search
• Which sounds exactly like a binary search tree…
WHAT’S WRONG WITH BINARY?
• Node(Node* left, int value, Node* right)
• how much memory does the CPU read?
• >= 1 cache line
• usually 64 bytes
• even more if you read from disk
SO… HOW ABOUT
BITMAPPED VECTOR TRIES?
BITMAPPED VECTOR TRIE
COMPLEXITIES
• We don’t really need to search - we know the exact
index we care about
• Lookup - O(logk N)
• Let’s set k = N!!!
• * this vector trie would not be persistent though
PERSISTENT VECTOR
COMPLEXITIES
• Lookup - O(logk N)
• constant work per node
• Update - O(k * logk N)
• need to copy k elements for each node
WE NEED BALANCE
LOOKUP VS UPDATE SPEED
• Lookup gets faster with
larger k
• Updates are more
complicated
Source: http://hypirion.com/
EVEN MORE PERF
TAIL OPTIMIZATION
• What do people usually do with vectors?
• They append to them
• Let’s optimize for that
TAIL OPTIMIZATION
Keep the tail separate
Source: http://hypirion.com/
SCALA’S FOCUS
• Like a tail, but for any index
• Optimizes local operations
TRANSIENTS
• When it’s all still too slow
• Prevents the data structure from being persistent for
a while
EXTENSIBILITY
7 4 5 2 111 92 173 44 35 13
IT ACTUALLY WORKS
THANKS!
IVAN VERGILIEV

More Related Content

What's hot

Effective testing for spark programs scala bay preview (pre-strata ny 2015)
Effective testing for spark programs scala bay preview (pre-strata ny 2015)Effective testing for spark programs scala bay preview (pre-strata ny 2015)
Effective testing for spark programs scala bay preview (pre-strata ny 2015)
Holden Karau
 
Puppetcamp Melbourne - puppetdb
Puppetcamp Melbourne - puppetdbPuppetcamp Melbourne - puppetdb
Puppetcamp Melbourne - puppetdb
m_richardson
 
Meetup slides
Meetup slidesMeetup slides
Meetup slides
suraj_atreya
 
Elastic Search
Elastic SearchElastic Search
Elastic Search
Lukas Vlcek
 
Machine Learning in a Twitter ETL using ELK
Machine Learning in a Twitter ETL using ELK Machine Learning in a Twitter ETL using ELK
Machine Learning in a Twitter ETL using ELK
hypto
 
Apache cassandra in 2016
Apache cassandra in 2016Apache cassandra in 2016
Apache cassandra in 2016
Duyhai Doan
 
Data stax academy
Data stax academyData stax academy
Data stax academy
Duyhai Doan
 
GPUs in Big Data - StampedeCon 2014
GPUs in Big Data - StampedeCon 2014GPUs in Big Data - StampedeCon 2014
GPUs in Big Data - StampedeCon 2014
StampedeCon
 
Bitquery GraphQL for Analytics on ClickHouse
Bitquery GraphQL for Analytics on ClickHouseBitquery GraphQL for Analytics on ClickHouse
Bitquery GraphQL for Analytics on ClickHouse
Altinity Ltd
 
Python in the database
Python in the databasePython in the database
Python in the database
pybcn
 
Cassandra 3.0 Awesomeness
Cassandra 3.0 AwesomenessCassandra 3.0 Awesomeness
Cassandra 3.0 Awesomeness
Jon Haddad
 
2014 spark with elastic search
2014   spark with elastic search2014   spark with elastic search
2014 spark with elastic search
Henry Saputra
 
Dcm#8 elastic search
Dcm#8  elastic searchDcm#8  elastic search
Dcm#8 elastic search
Ivan Wallarm
 
Visualizing ORACLE performance data with R @ #C16LV
Visualizing ORACLE performance data with R @ #C16LVVisualizing ORACLE performance data with R @ #C16LV
Visualizing ORACLE performance data with R @ #C16LV
Maxym Kharchenko
 
Logstash-Elasticsearch-Kibana
Logstash-Elasticsearch-KibanaLogstash-Elasticsearch-Kibana
Logstash-Elasticsearch-Kibana
dknx01
 
Apache zeppelin the missing component for the big data ecosystem
Apache zeppelin the missing component for the big data ecosystemApache zeppelin the missing component for the big data ecosystem
Apache zeppelin the missing component for the big data ecosystem
Duyhai Doan
 
2014 holden - databricks umd scala crash course
2014   holden - databricks umd scala crash course2014   holden - databricks umd scala crash course
2014 holden - databricks umd scala crash course
Holden Karau
 
How to Use JSON in MySQL Wrong
How to Use JSON in MySQL WrongHow to Use JSON in MySQL Wrong
How to Use JSON in MySQL Wrong
Karwin Software Solutions LLC
 
Drupal and Elasticsearch
Drupal and ElasticsearchDrupal and Elasticsearch
Drupal and Elasticsearch
Nikolay Ignatov
 
Beyond Shuffling, Tips and Tricks for Scaling Apache Spark updated for Spark ...
Beyond Shuffling, Tips and Tricks for Scaling Apache Spark updated for Spark ...Beyond Shuffling, Tips and Tricks for Scaling Apache Spark updated for Spark ...
Beyond Shuffling, Tips and Tricks for Scaling Apache Spark updated for Spark ...
Holden Karau
 

What's hot (20)

Effective testing for spark programs scala bay preview (pre-strata ny 2015)
Effective testing for spark programs scala bay preview (pre-strata ny 2015)Effective testing for spark programs scala bay preview (pre-strata ny 2015)
Effective testing for spark programs scala bay preview (pre-strata ny 2015)
 
Puppetcamp Melbourne - puppetdb
Puppetcamp Melbourne - puppetdbPuppetcamp Melbourne - puppetdb
Puppetcamp Melbourne - puppetdb
 
Meetup slides
Meetup slidesMeetup slides
Meetup slides
 
Elastic Search
Elastic SearchElastic Search
Elastic Search
 
Machine Learning in a Twitter ETL using ELK
Machine Learning in a Twitter ETL using ELK Machine Learning in a Twitter ETL using ELK
Machine Learning in a Twitter ETL using ELK
 
Apache cassandra in 2016
Apache cassandra in 2016Apache cassandra in 2016
Apache cassandra in 2016
 
Data stax academy
Data stax academyData stax academy
Data stax academy
 
GPUs in Big Data - StampedeCon 2014
GPUs in Big Data - StampedeCon 2014GPUs in Big Data - StampedeCon 2014
GPUs in Big Data - StampedeCon 2014
 
Bitquery GraphQL for Analytics on ClickHouse
Bitquery GraphQL for Analytics on ClickHouseBitquery GraphQL for Analytics on ClickHouse
Bitquery GraphQL for Analytics on ClickHouse
 
Python in the database
Python in the databasePython in the database
Python in the database
 
Cassandra 3.0 Awesomeness
Cassandra 3.0 AwesomenessCassandra 3.0 Awesomeness
Cassandra 3.0 Awesomeness
 
2014 spark with elastic search
2014   spark with elastic search2014   spark with elastic search
2014 spark with elastic search
 
Dcm#8 elastic search
Dcm#8  elastic searchDcm#8  elastic search
Dcm#8 elastic search
 
Visualizing ORACLE performance data with R @ #C16LV
Visualizing ORACLE performance data with R @ #C16LVVisualizing ORACLE performance data with R @ #C16LV
Visualizing ORACLE performance data with R @ #C16LV
 
Logstash-Elasticsearch-Kibana
Logstash-Elasticsearch-KibanaLogstash-Elasticsearch-Kibana
Logstash-Elasticsearch-Kibana
 
Apache zeppelin the missing component for the big data ecosystem
Apache zeppelin the missing component for the big data ecosystemApache zeppelin the missing component for the big data ecosystem
Apache zeppelin the missing component for the big data ecosystem
 
2014 holden - databricks umd scala crash course
2014   holden - databricks umd scala crash course2014   holden - databricks umd scala crash course
2014 holden - databricks umd scala crash course
 
How to Use JSON in MySQL Wrong
How to Use JSON in MySQL WrongHow to Use JSON in MySQL Wrong
How to Use JSON in MySQL Wrong
 
Drupal and Elasticsearch
Drupal and ElasticsearchDrupal and Elasticsearch
Drupal and Elasticsearch
 
Beyond Shuffling, Tips and Tricks for Scaling Apache Spark updated for Spark ...
Beyond Shuffling, Tips and Tricks for Scaling Apache Spark updated for Spark ...Beyond Shuffling, Tips and Tricks for Scaling Apache Spark updated for Spark ...
Beyond Shuffling, Tips and Tricks for Scaling Apache Spark updated for Spark ...
 

Similar to Persistent Data Structures - partial::Conf

Ben Coverston - The Apache Cassandra Project
Ben Coverston - The Apache Cassandra ProjectBen Coverston - The Apache Cassandra Project
Ben Coverston - The Apache Cassandra Project
Morningstar Tech Talks
 
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
NoSQLmatters
 
SPL: The Undiscovered Library - DataStructures
SPL: The Undiscovered Library -  DataStructuresSPL: The Undiscovered Library -  DataStructures
SPL: The Undiscovered Library - DataStructures
Mark Baker
 
Master tuning
Master   tuningMaster   tuning
Master tuning
Thomas Kejser
 
System insight without Interference
System insight without InterferenceSystem insight without Interference
System insight without Interference
Tony Tam
 
Microservices and Teraflops: Effortlessly Scaling Data Science with PyWren wi...
Microservices and Teraflops: Effortlessly Scaling Data Science with PyWren wi...Microservices and Teraflops: Effortlessly Scaling Data Science with PyWren wi...
Microservices and Teraflops: Effortlessly Scaling Data Science with PyWren wi...
Databricks
 
Fact based monitoring
Fact based monitoringFact based monitoring
Fact based monitoring
Datadog
 
Fact-Based Monitoring
Fact-Based MonitoringFact-Based Monitoring
Fact-Based Monitoring
Datadog
 
Using JPA applications in the era of NoSQL: Introducing Hibernate OGM
Using JPA applications in the era of NoSQL: Introducing Hibernate OGMUsing JPA applications in the era of NoSQL: Introducing Hibernate OGM
Using JPA applications in the era of NoSQL: Introducing Hibernate OGM
PT.JUG
 
Why databases cry at night
Why databases cry at nightWhy databases cry at night
Why databases cry at night
Michael Yarichuk
 
MYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to SphinxMYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to Sphinx
Pythian
 
An Introduction to Elastic Search.
An Introduction to Elastic Search.An Introduction to Elastic Search.
An Introduction to Elastic Search.
Jurriaan Persyn
 
2 Years of Real World FP at REA
2 Years of Real World FP at REA2 Years of Real World FP at REA
2 Years of Real World FP at REA
kenbot
 
Speedment - Reactive programming for Java8
Speedment - Reactive programming for Java8Speedment - Reactive programming for Java8
Speedment - Reactive programming for Java8
Speedment, Inc.
 
Dev nexus 2017
Dev nexus 2017Dev nexus 2017
Dev nexus 2017
Roy Russo
 
Scaling out Tensorflow-as-a-Service on Spark and Commodity GPUs
Scaling out Tensorflow-as-a-Service on Spark and Commodity GPUsScaling out Tensorflow-as-a-Service on Spark and Commodity GPUs
Scaling out Tensorflow-as-a-Service on Spark and Commodity GPUs
Jim Dowling
 
Apache Spark and Tensorflow as a Service with Jim Dowling
Apache Spark and Tensorflow as a Service with Jim DowlingApache Spark and Tensorflow as a Service with Jim Dowling
Apache Spark and Tensorflow as a Service with Jim Dowling
Spark Summit
 
Apache Spark and Tensorflow as a Service with Jim Dowling
Apache Spark and Tensorflow as a Service with Jim DowlingApache Spark and Tensorflow as a Service with Jim Dowling
Apache Spark and Tensorflow as a Service with Jim Dowling
Spark Summit
 
Basic terminologies & asymptotic notations
Basic terminologies & asymptotic notationsBasic terminologies & asymptotic notations
Basic terminologies & asymptotic notations
Rajendran
 
Lazy vs. Eager Loading Strategies in JPA 2.1
Lazy vs. Eager Loading Strategies in JPA 2.1Lazy vs. Eager Loading Strategies in JPA 2.1
Lazy vs. Eager Loading Strategies in JPA 2.1
Patrycja Wegrzynowicz
 

Similar to Persistent Data Structures - partial::Conf (20)

Ben Coverston - The Apache Cassandra Project
Ben Coverston - The Apache Cassandra ProjectBen Coverston - The Apache Cassandra Project
Ben Coverston - The Apache Cassandra Project
 
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
 
SPL: The Undiscovered Library - DataStructures
SPL: The Undiscovered Library -  DataStructuresSPL: The Undiscovered Library -  DataStructures
SPL: The Undiscovered Library - DataStructures
 
Master tuning
Master   tuningMaster   tuning
Master tuning
 
System insight without Interference
System insight without InterferenceSystem insight without Interference
System insight without Interference
 
Microservices and Teraflops: Effortlessly Scaling Data Science with PyWren wi...
Microservices and Teraflops: Effortlessly Scaling Data Science with PyWren wi...Microservices and Teraflops: Effortlessly Scaling Data Science with PyWren wi...
Microservices and Teraflops: Effortlessly Scaling Data Science with PyWren wi...
 
Fact based monitoring
Fact based monitoringFact based monitoring
Fact based monitoring
 
Fact-Based Monitoring
Fact-Based MonitoringFact-Based Monitoring
Fact-Based Monitoring
 
Using JPA applications in the era of NoSQL: Introducing Hibernate OGM
Using JPA applications in the era of NoSQL: Introducing Hibernate OGMUsing JPA applications in the era of NoSQL: Introducing Hibernate OGM
Using JPA applications in the era of NoSQL: Introducing Hibernate OGM
 
Why databases cry at night
Why databases cry at nightWhy databases cry at night
Why databases cry at night
 
MYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to SphinxMYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to Sphinx
 
An Introduction to Elastic Search.
An Introduction to Elastic Search.An Introduction to Elastic Search.
An Introduction to Elastic Search.
 
2 Years of Real World FP at REA
2 Years of Real World FP at REA2 Years of Real World FP at REA
2 Years of Real World FP at REA
 
Speedment - Reactive programming for Java8
Speedment - Reactive programming for Java8Speedment - Reactive programming for Java8
Speedment - Reactive programming for Java8
 
Dev nexus 2017
Dev nexus 2017Dev nexus 2017
Dev nexus 2017
 
Scaling out Tensorflow-as-a-Service on Spark and Commodity GPUs
Scaling out Tensorflow-as-a-Service on Spark and Commodity GPUsScaling out Tensorflow-as-a-Service on Spark and Commodity GPUs
Scaling out Tensorflow-as-a-Service on Spark and Commodity GPUs
 
Apache Spark and Tensorflow as a Service with Jim Dowling
Apache Spark and Tensorflow as a Service with Jim DowlingApache Spark and Tensorflow as a Service with Jim Dowling
Apache Spark and Tensorflow as a Service with Jim Dowling
 
Apache Spark and Tensorflow as a Service with Jim Dowling
Apache Spark and Tensorflow as a Service with Jim DowlingApache Spark and Tensorflow as a Service with Jim Dowling
Apache Spark and Tensorflow as a Service with Jim Dowling
 
Basic terminologies & asymptotic notations
Basic terminologies & asymptotic notationsBasic terminologies & asymptotic notations
Basic terminologies & asymptotic notations
 
Lazy vs. Eager Loading Strategies in JPA 2.1
Lazy vs. Eager Loading Strategies in JPA 2.1Lazy vs. Eager Loading Strategies in JPA 2.1
Lazy vs. Eager Loading Strategies in JPA 2.1
 

Recently uploaded

fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.
AnkitaPandya11
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Preparing Non - Technical Founders for Engaging a Tech Agency
Preparing Non - Technical Founders for Engaging  a  Tech AgencyPreparing Non - Technical Founders for Engaging  a  Tech Agency
Preparing Non - Technical Founders for Engaging a Tech Agency
ISH Technologies
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
GohKiangHock
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
YousufSait3
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
Karya Keeper
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 

Recently uploaded (20)

fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Preparing Non - Technical Founders for Engaging a Tech Agency
Preparing Non - Technical Founders for Engaging  a  Tech AgencyPreparing Non - Technical Founders for Engaging  a  Tech Agency
Preparing Non - Technical Founders for Engaging a Tech Agency
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 

Persistent Data Structures - partial::Conf

Editor's Notes

  1. explain what IOI and an informatics competition is
  2. They care about performance (well, except for complicated algorithms and data structures) We can have essentially the same solution, but if mine is 5 times slower than yours, I’ll fail To be honest, this matters especially when you can’t figure out the exact solution so you force your way there second place because I wrote the fastest “wrong” solution Writing efficient brute-force solutions is one of the most important skills in these competitions
  3. so I had kind of a rough start with functional programming not so much because of inherent qualities but because of mindset
  4. I studied FP when I was in university I’d ask “this sounds horribly inefficient, how does it actually work?” this was the answer ^
  5. That’s not exactly how computers work Or at least not at the level of understanding that I’d like to have
  6. - I’ll be comparing to Version Control Systems (as mentioned during the previous talk)
  7. once you modify it, it’s gone this is the default in most imperative and OO programming languages it’s like programming without version control - no history, very hard to synchronize
  8. it’s like git without branching git commit at HEAD only; git checkout
  9. version history is linear
  10. git commit, git checkout, git branch / git checkout -b version history is now a tree what’s missing? (git merge)
  11. - Already discussed during the previous talk
  12. - it’s a bit more complicated in some circumstances - e.g. if you don’t have GC
  13. - obvious at a functional programming conference, but it is actually something that persistent data structures allow us to do efficiently
  14. - if you think about it, this is exactly transaction rollback, but slightly closer to the user
  15. this is all completely speculative but it sounds very much like a persistent data structure Postgres team is certainly aware of persistent data structures so this is either not a priority or there are some implementation concerns
  16. keeping a list of changes is hard to maintain and doesn’t scale need to keep a mapping between action and reverse action and be very careful with it can’t go back multiple states at a time
  17. if this sounds too exotic, consider what your browser is doing all the time I know this doesn’t look related to any of the previous things, so we’ll take it step by step
  18. if you look at the white stripe in the middle, you can see there are no intersections inside it and all the segments are ordered ordered means we can do binary search not exactly by starting point, but you can do the math and order by it and we can put them in a binary tree order is the same, but the bounds change do a binary search to determine the right vertical stripe
  19. if you look at the white stripe in the middle, you can see there are no intersections inside it and all the segments are ordered ordered means we can do binary search not exactly by starting point, but you can do the math and order by it do a binary search to determine the right vertical stripe
  20. what happens when xs goes out of scope? we need to find a way to get rid of it
  21. we went from nice, immutable data structures to each node being mutable and requiring synchronization depending on the usage pattern, this might cause contention on the reference counters destruction needs to free all elements recursively
  22. I’ll start from far away and build up to it
  23. O(log k * log_k N) for search if we binary search inside the node
  24. what’s wrong is cache friendliness and memory locality disk block ~4kb
  25. given a lookup or update index, we know exactly what position in the node we care about lookup is O(log_k N), if update is the same - let’s make k = N? well, that’s exactly what we do - in C++ vectors, Java ArrayLists, etc.
  26. - we have to figure out how often we do update vs lookups
  27. - removes the log_k N multiplier for 31 out of 32 appends