Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beerose/wroc-ts-08-talk
https://github.com/beerose/wroc-ts-08-talk
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/beerose/wroc-ts-08-talk
- Owner: beerose
- Created: 2019-10-28T18:11:20.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-11T11:26:18.000Z (over 4 years ago)
- Last Synced: 2025-01-01T02:15:33.401Z (10 days ago)
- Language: TypeScript
- Size: 8.52 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
---
title: Persistent data structures thanks to recursive type aliases
---_the talk_
# How
with a kickass **15** minute presentation, entirely in VSCode.
# Why
It's well known that mutability is evil and often troublesome,
but you can stop shallow copying arrays (or god-forbid deep copying)
every time you want to change them. Let me show you how.Immutable data structures are the tool for the job when immutability is required. \
Time to add them to our toolset.Persistent data structures are good to know when your product needs time-travel capabilities
(like text inputs -- they are pretty bad if CTRL+Z doesn't work).TODO: Make "Why" shorter?
# What
- What does the `persistent data structure` mean?
- Meet Cons List
- How it looks in TypeScript 3.7
- How it looked before TS3.7
- Functions operating on ConsList
- (big reveal) Instances of fp-ts typeclasses
- Benchmarks of Cons List vs Array operations---
## Benchmarks
### Mutable operations vs cons
| Opeation | ops/s |
| :-------------------------------- | ----------: |
| array.unshift(50) | 99953.939 |
| array.push(50) | 70675.276 |
| cons(50, list) | 5822999.798 |### Immutable operation vs cons
| Operation | ops/s |
| :---------------------------- | ----------: |
| [50, ...array] | 12680.588 |
| cons(50, list) | 5485947.933 |### _Array.prototype_.map vs map
| Operation | ops/s |
| :------------------------------------ | -------: |
| array.map(x => x \* 2) | 4389.837 |
| map(list, x => x \* 2) | 662.805 |---
_quick reminders_# Controls
```json
{
"key": "cmd+alt+left",
"command": "workbench.action.previousEditor"
},
{
"key": "cmd+alt+right",
"command": "workbench.action.nextEditor"
},
{
"key": "cmd+shift+q",
"command": "quokka.toggle",
"when": "editorTextFocus"
},
```Move quickly through the slides with
- `Cmd + Alt + LeftArrow` → _View: Open Previous Editor_
- `Cmd + Alt + RightArrow` → _View: Open Next Editor_Run TypeScript slides with
- `Cmd + Shift + Q` → _Quokka.js: Toggle (Start/Stop) on Current File_Minimize distractions and maximize screen space
- `Cmd + B` → _(built-in) View: Toggle Side Bar Visibility_Use regions to hide imports and code pasted from previous slides
![](assets/2019-10-28-19-43-38.png)