tldraw
@tldraw
Followers
71K
Following
7K
Media
2K
Statuses
5K
infinite canvas | https://t.co/oXL4NAc6P8 | https://t.co/dO6WPp6YOI | https://t.co/beo7WsKiVe | /tiː ɛl drɔː/
London
Joined February 2021
You can read the PR here: https://t.co/FzZsJZfPRR. (Follow up PR replaced some of the x - x === 0 with Number.isFinite) If you have more ideas, let me know!
github.com
Optimizes validators in @tldraw/validate with multiple performance improvements that provide 10-160x speedup on number validators and 2-3x speedup on complex validators. Summary of optimizations N...
0
1
1
It just needs to be extremely fast. Faster better. Fast fast fast. sonic.jpg
1
0
2
We do this kind of runtime validation on every change to the main record store (for shapes, pages, users, etc). It’s such a good safety net, especially when bad data (null values, unexpected signs) risk being persisted or propagated to collaborators.
1
0
1
This kind of optimization is eminently Claudable. Set up benchmarks, run them against main and output to md file, and then branch and iterate against those results. Local bench is fine because we’re just interested in relative improvements.
1
0
1
There were lots of other small improvements too, such as moving a dev-time check, skipping some nesting on extended validators, and skipping some other checks when recursing.
1
0
0
So rather than checking if the number is NaN and returning early with an error, then checking for finite and returning early with an error, or else returning success, we check for success immediately and then, if it failed, make those other checks to determine _why_ it failed.
1
0
0
We also moved things around, optimizing for the expected path at the cost of making the error path slower.
1
0
0
The big speed up was in how we checked whether a value was a number or not. Beyond the typeof, we previously used both typeof and Number.isNaN and Number.isFinite. This was actually redundant: isFinite was all we needed.
1
0
0
In the next version of tldraw, our runtime validation system is about twice as fast. It was already pretty fast! but now it’s faster.
2
1
19
In my newest gen ai research experiment i used @tldraw fairies to generate a flowchart for a research organizer app and then used the flowchart to generate fully working aaa research organizer app w @GeminiApp
0
1
2
In the next version of tldraw, we fix a very entertaining bug that would effect flipping rotated shapes that include freehand shapes.
0
5
51
Probably my favorite feature in @tldraw Past in a link and it creates these nice graphics from it 🤩
5
11
138
We're hoping to find more places to ship less code and sync fewer bytes. If you're into this kind of thing, you can read through the pull request here:
github.com
This PR reduces the storage size of draw and highlight shapes by encoding point data as base64 strings using Float16 representation instead of JSON arrays of VecModel objects. Each point (x, y, z) ...
0
0
35
Resizing draw shapes should now be faster too. Previously, we would rescale points during resize to fix the shape's new bounding box. We now store the differences in x/y scale separately and multiply at render time. Less work to do and less to sync.
1
0
27
It might also help with performance. Although the points are stored in a compressed format, we don't need to decode the whole array in order to access points. We are able to selectively decode any point within the compressed array because the bits in the array are regular.
3
0
39
This is meant to address a common issue we've seen where files containing many hand-drawn shapes would become unexpectedly large, leading to slower loading times and synchronization. Those files should be up to 80% smaller now.
1
0
71
In the next version of tldraw, we're introducing a compressed format for storing points for freehand shapes. Each point (x, y, z) is now encoded as 6 bytes (3 Float16 values) = 8 base64 characters, compared to approximately 40+ bytes per point in the previous JSON format. This
41
18
914