lots
Deploy Quartz site to GitHub Pages / build (push) Canceled after 0s
Deploy Quartz site to GitHub Pages / deploy (push) Canceled after 0s

This commit is contained in:
ed committed 2026-11-16 09:59:30 -05:00
1 parent a30caeff69
commit 30da767d56
399 files changed
+15378

No files matched your search

@@ -0,0 +1,37 @@
---
title: "@TrisH0x2A 200 bytes to halve the divides."
type: archive
source: twitter
source_url: "https://x.com/MaiHoonHira/status/2098150409617707409"
author: "Hira Jha"
handle: MaiHoonHira
post_id: "2098150409617707409"
date: 2026-09-10
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- TrisH0x2A
description: "@TrisH0x2A 200 bytes to halve the divides."
in_reply_to: ""
parent_post_id: "2098135741075497111"
---
## Source
- URL: https://x.com/MaiHoonHira/status/2098150409617707409
- Author: Hira Jha (@MaiHoonHira)
- Posted: 2026-09-10 20:43:34
## Branch
**1/** **@MaiHoonHira** ^2098150409617707409
**@TrisH0x2A**
200 bytes to halve the divides. Good trade.
## Related
- Spine: [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits]]
@@ -0,0 +1,37 @@
---
title: "@TrisH0x2A Did you solve the hyphen problem"
type: archive
source: twitter
source_url: "https://x.com/onetyone_a/status/2098138124907893230"
author: "backbencher"
handle: onetyone_a
post_id: "2098138124907893230"
date: 2026-09-10
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- TrisH0x2A
description: "@TrisH0x2A Did you solve the hyphen problem"
in_reply_to: ""
parent_post_id: "2098135741075497111"
---
## Source
- URL: https://x.com/onetyone_a/status/2098138124907893230
- Author: backbencher (@onetyone_a)
- Posted: 2026-09-10 19:54:45
## Branch
**1/** **@onetyone_a** ^2098138124907893230
**@TrisH0x2A**
Did you solve the hyphen problem
## Related
- Spine: [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits]]
@@ -0,0 +1,63 @@
---
title: "That's pretty cool!"
type: archive
source: twitter
source_url: "https://x.com/Dark_Goldenrod/status/2098207974212686092"
author: "Dark Goldenrod"
handle: Dark_Goldenrod
post_id: "2098207974212686092"
date: 2026-09-11
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- TrisH0x2A
description: "That's pretty cool!"
in_reply_to: ""
parent_post_id: "2098135741075497111"
---
## Source
- URL: https://x.com/Dark_Goldenrod/status/2098207974212686092
- Author: Dark Goldenrod (@Dark_Goldenrod)
- Posted: 2026-09-11 00:32:18
## Branch
**1/** **@Dark_Goldenrod** ^2098207974212686092
That's pretty cool!
In writing my upcoming database, I really saw just how expensive num->str can be!
At times, it was >10% of total time for queries!
In my testing, I found that the entire penalty for the function was in the needed length calculation... it's a long enough and branchful-enough process to break your cpu predictors before returning to the parent code.
Does SQL still calculate the output length?
I tried similar lookup tables and they were always slower in practice than div+mod in a "repnz" loop, where the divisions and mods get to runahead.
Here is the unsigned version that I profiled as the fastest in practice:
sized_ptr_t simple_ustoa(uint64_t value, char* buffer)
{
char *ptr = buffer + 32 - 1;
do {
*ptr-- = '0' + (value % 10);
value /= 10;
} while (value > 0);
ptr++;
return sized_ptr_t_create(ptr, 32 - (ptr - buffer));
}
Where buffer is char buffer[33]; buffer[32] = '\0'; (for null-terminated result).
There's also a signed version, which has two extra branches (one before the loop and one after) to handle the negative.
## Related
- Spine: [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits]]
@@ -0,0 +1,39 @@
---
title: "@TrisH0x2A Using `sqlite3DigitPairs`"
type: archive
source: twitter
source_url: "https://x.com/da_miao_zi/status/2098248626036494841"
author: "JackalHu"
handle: da_miao_zi
post_id: "2098248626036494841"
date: 2026-09-11
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- TrisH0x2A
description: "@TrisH0x2A Using `sqlite3DigitPairs`"
in_reply_to: ""
parent_post_id: "2098135741075497111"
---
## Source
- URL: https://x.com/da_miao_zi/status/2098248626036494841
- Author: JackalHu (@da_miao_zi)
- Posted: 2026-09-11 03:13:50
## Branch
**1/** **@da_miao_zi** ^2098248626036494841
**@TrisH0x2A**
Using `sqlite3DigitPairs`
![](https://pbs.twimg.com/media/HR55pPua4AALmdD?format=jpg&name=orig)
## Related
- Spine: [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits]]
@@ -0,0 +1,41 @@
---
title: "@TrisH0x2A That's actually a fairly standard tactic."
type: archive
source: twitter
source_url: "https://x.com/istartedi/status/2098250943569514664"
author: "我不会说中文 🆗"
handle: istartedi
post_id: "2098250943569514664"
date: 2026-09-11
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- TrisH0x2A
description: "@TrisH0x2A That's actually a fairly standard tactic."
in_reply_to: ""
parent_post_id: "2098135741075497111"
---
## Source
- URL: https://x.com/istartedi/status/2098250943569514664
- Author: 我不会说中文 🆗 (@istartedi)
- Posted: 2026-09-11 03:23:03
## Branch
**1/** **@istartedi** ^2098250943569514664
**@TrisH0x2A**
That's actually a fairly standard tactic.
There's an even more optimized algorithm out there.
I think this one might be fastest:
https://github.com/jeaiii/itoa/blob/c20e4bdbcdbad853aa985e385f6cac2511f6ffbf/itoa/int_to_chars_jeaiii.h
## Related
- Spine: [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits]]
@@ -0,0 +1,37 @@
---
title: "@TrisH0x2A Funny, I had to do that when programming a game for MSX (Z80 CPU)"
type: archive
source: twitter
source_url: "https://x.com/jannone/status/2098403949896237371"
author: "Jannone 👾"
handle: jannone
post_id: "2098403949896237371"
date: 2026-09-11
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- TrisH0x2A
description: "@TrisH0x2A Funny, I had to do that when programming a game for MSX (Z80 CPU)"
in_reply_to: ""
parent_post_id: "2098135741075497111"
---
## Source
- URL: https://x.com/jannone/status/2098403949896237371
- Author: Jannone 👾 (@jannone)
- Posted: 2026-09-11 13:31:02
## Branch
**1/** **@jannone** ^2098403949896237371
**@TrisH0x2A**
Funny, I had to do that when programming a game for MSX (Z80 CPU)
## Related
- Spine: [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits]]
@@ -0,0 +1,37 @@
---
title: "@TrisH0x2A ithkuil is base 100."
type: archive
source: twitter
source_url: "https://x.com/mathtician/status/2098237261930217564"
author: "Mathtician"
handle: mathtician
post_id: "2098237261930217564"
date: 2026-09-11
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- TrisH0x2A
description: "@TrisH0x2A ithkuil is base 100."
in_reply_to: ""
parent_post_id: "2098135741075497111"
---
## Source
- URL: https://x.com/mathtician/status/2098237261930217564
- Author: Mathtician (@mathtician)
- Posted: 2026-09-11 02:28:41
## Branch
**1/** **@mathtician** ^2098237261930217564
**@TrisH0x2A**
ithkuil is base 100. coincidence?
## Related
- Spine: [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits]]
@@ -0,0 +1,37 @@
---
title: "@TrisH0x2A This is how Rust does it as well."
type: archive
source: twitter
source_url: "https://x.com/max_conradt/status/2098245937793741245"
author: "Max Conradt"
handle: max_conradt
post_id: "2098245937793741245"
date: 2026-09-11
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- TrisH0x2A
description: "@TrisH0x2A This is how Rust does it as well."
in_reply_to: ""
parent_post_id: "2098135741075497111"
---
## Source
- URL: https://x.com/max_conradt/status/2098245937793741245
- Author: Max Conradt (@max_conradt)
- Posted: 2026-09-11 03:03:09
## Branch
**1/** **@max_conradt** ^2098245937793741245
**@TrisH0x2A**
This is how Rust does it as well. If you run strings on a Rust binary you will see this entire table. Likely true for many other compiled languages' stdlib itoa and native itoa implementations.
## Related
- Spine: [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits]]
@@ -0,0 +1,37 @@
---
title: "@TrisH0x2A Most meaning half?"
type: archive
source: twitter
source_url: "https://x.com/minusYCore/status/2098419137773007312"
author: "Mongo"
handle: minusYCore
post_id: "2098419137773007312"
date: 2026-09-11
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- TrisH0x2A
description: "@TrisH0x2A Most meaning half?"
in_reply_to: ""
parent_post_id: "2098135741075497111"
---
## Source
- URL: https://x.com/minusYCore/status/2098419137773007312
- Author: Mongo (@minusYCore)
- Posted: 2026-09-11 14:31:23
## Branch
**1/** **@minusYCore** ^2098419137773007312
**@TrisH0x2A**
Most meaning half?
## Related
- Spine: [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits]]
@@ -0,0 +1,37 @@
---
title: "@TrisH0x2A No, you do zero a actual divisions."
type: archive
source: twitter
source_url: "https://x.com/noop_dev/status/2098451074088599803"
author: "Boris Chuprin"
handle: noop_dev
post_id: "2098451074088599803"
date: 2026-09-11
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- TrisH0x2A
description: "@TrisH0x2A No, you do zero a actual divisions."
in_reply_to: ""
parent_post_id: "2098135741075497111"
---
## Source
- URL: https://x.com/noop_dev/status/2098451074088599803
- Author: Boris Chuprin (@noop_dev)
- Posted: 2026-09-11 16:38:18
## Branch
**1/** **@noop_dev** ^2098451074088599803
**@TrisH0x2A**
No, you do zero a actual divisions. Those are slow. It's actually done with multiplications. The approach above saves 50% of mula but it's not a 2x win due to extra logic. Accessing an array is actually somewhat slower than multiplication.
## Related
- Spine: [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits]]
@@ -0,0 +1,39 @@
---
title: "@TrisH0x2A Here's how to convert an integer to a number with no division"
type: archive
source: twitter
source_url: "https://x.com/silenceofnight/status/2098212914188497060"
author: "Jeremy Mikkola"
handle: silenceofnight
post_id: "2098212914188497060"
date: 2026-09-11
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- TrisH0x2A
description: "@TrisH0x2A Here's how to convert an integer to a number with no division"
in_reply_to: ""
parent_post_id: "2098135741075497111"
---
## Source
- URL: https://x.com/silenceofnight/status/2098212914188497060
- Author: Jeremy Mikkola (@silenceofnight)
- Posted: 2026-09-11 00:51:56
## Branch
**1/** **@silenceofnight** ^2098212914188497060
**@TrisH0x2A**
Here's how to convert an integer to a number with no division
![](https://pbs.twimg.com/media/HR5ZdatXEAEzPlG?format=png&name=orig)
## Related
- Spine: [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits]]
@@ -0,0 +1,39 @@
---
title: "@TrisH0x2A Can also be found in Factorio!"
type: archive
source: twitter
source_url: "https://x.com/zaafonin/status/2098485818201719100"
author: "zaafonin"
handle: zaafonin
post_id: "2098485818201719100"
date: 2026-09-11
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- TrisH0x2A
description: "@TrisH0x2A Can also be found in Factorio!"
in_reply_to: ""
parent_post_id: "2098135741075497111"
---
## Source
- URL: https://x.com/zaafonin/status/2098485818201719100
- Author: zaafonin (@zaafonin)
- Posted: 2026-09-11 18:56:21
## Branch
**1/** **@zaafonin** ^2098485818201719100
**@TrisH0x2A**
Can also be found in Factorio!
![](https://pbs.twimg.com/media/HR9Rui-bQAAs4QA?format=png&name=orig)
## Related
- Spine: [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits]]
@@ -0,0 +1,37 @@
---
title: "@TrisH0x2A And how does it pull out 2 digits from the number without division"
type: archive
source: twitter
source_url: "https://x.com/yashv_singh/status/2098647925853462992"
author: "Neutral net 🕸️"
handle: yashv_singh
post_id: "2098647925853462992"
date: 2026-09-12
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- TrisH0x2A
description: "@TrisH0x2A And how does it pull out 2 digits from the number without division"
in_reply_to: ""
parent_post_id: "2098135741075497111"
---
## Source
- URL: https://x.com/yashv_singh/status/2098647925853462992
- Author: Neutral net 🕸️ (@yashv_singh)
- Posted: 2026-09-12 05:40:31
## Branch
**1/** **@yashv_singh** ^2098647925853462992
**@TrisH0x2A**
And how does it pull out 2 digits from the number without division
## Related
- Spine: [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits]]
@@ -0,0 +1,44 @@
---
title: "TIL SQLite converts integers to text two digits at a time"
type: archive
source: twitter
source_url: "https://x.com/TrisH0x2A/status/2098135741075497111"
author: "trish"
handle: TrisH0x2A
post_id: "2098135741075497111"
date: 2026-09-10
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- TrisH0x2A
description: "TIL SQLite converts integers to text two digits at a time"
in_reply_to: ""
---
## Source
- URL: https://x.com/TrisH0x2A/status/2098135741075497111
- Author: trish (@TrisH0x2A)
- Posted: 2026-09-10 19:45:16
## Thread
**1/** **@TrisH0x2A** ^2098135741075497111
TIL SQLite converts integers to text two digits at a time
converting an integer to text usually means a loop of /10 and %10
sqlite avoids most of those divisions by keeping a 200-byte string of every two-digit pair from 00 to 99, and pulling two digits at a time out of it by direct index instead of computing them
![](https://pbs.twimg.com/media/HR4TS3nbAAASl7c?format=png&name=orig)
Branches: [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits/2026-09-10-onetyone_a-did-you-solve-the-hyphen-problem]], [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits/2026-09-10-MaiHoonHira-200-bytes-to-halve-the-divides-good-trade]], [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits/2026-09-11-Dark_Goldenrod-thats-pretty-cool-in-writing-my-upcoming-database]], [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits/2026-09-11-silenceofnight-heres-how-to-convert-an-integer-to-a-number-with]], [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits/2026-09-11-mathtician-ithkuil-is-base-100-coincidence]], [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits/2026-09-11-max_conradt-this-is-how-rust-does-it-as-well-if-you-run]], [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits/2026-09-11-da_miao_zi-using-sqlite3digitpairs]], [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits/2026-09-11-istartedi-thats-actually-a-fairly-standard-tactic-theres-an]], [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits/2026-09-11-jannone-funny-i-had-to-do-that-when-programming-a-game]], [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits/2026-09-11-minusYCore-most-meaning-half]], [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits/2026-09-11-noop_dev-no-you-do-zero-a-actual-divisions-those-are-slow]], [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits/2026-09-11-zaafonin-can-also-be-found-in-factorio]], [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits/2026-09-12-yashv_singh-and-how-does-it-pull-out-2-digits-from-the-number]]
**2/** **@QuadooScript** ^2098137931236176156
**@TrisH0x2A** **@grok**
What are the real world metrics on this performance design?
+12
View File
@@ -0,0 +1,12 @@
---
title: TrisH0x2A
type: note
draft: false
description: Archived threads by TrisH0x2A.
tags:
- archive
- twitter
- TrisH0x2A
---
- [[archive/threads/TrisH0x2A/2026-09-10-til-sqlite-converts-integers-to-text-two-digits]]