Maja changed the topic of ##bash-crimes to: we bash back | club of folks preoccupied in whether they could, not whether they should | logs https://libera.irclog.whitequark.org/~h~bash-crimes
dermoth has quit [Read error: Connection reset by peer]
dermoth has joined ##bash-crimes
<sdomi> i will ask a very stupid question. does anyone know of a SQL sanitization library that i could use in bash ~~or do i have to write everything myself~~
<sdomi> thinking postgres
<sdomi> isabella: WOOOO this is so cool!!! i love how fast it works, you're a witch
<isabella> \o/
<isabella> it was a lot of work lol
<sdomi> i gotta actually look at your code when i find some spoons
<isabella> i'm trying to improve it but the perf is just so hard
<isabella> oh don't
<isabella> it bad
<sdomi> idc!
<sdomi> i like bad bash, that's what this channel is about
<sdomi> i didn't come here to write pure, beautiful, posix-compliant code; i came here to kick ass and write fun hacks :3
<isabella> the input handling is bad
<isabella> i want to get the kitty keyboard protocol working
<isabella> it's not even really solvable without that
<isabella> i was looking at this today and they have the exact same issues https://github.com/ludocode/doom-cli#controls
<isabella> there's a delay between the initial keypress and the repeat events and it feels super annoying, also you cannot send multiple keys at once
<isabella> maybe you could guess when some key is an initial keypress, and adjust for it so that it behaves differently and moves you further than the repeat events
<isabella> but that'd probably feel wrong too
<isabella> adding the shading to the colours was totally not worth it, it's not even pretty and it costs a lot of performance
<isabella> i have a benchmark and i had managed to produce the initial frame at the highest resolution in my terminal in <24ms with depth only or just over 24ms with colours only. combining depth and colour made it shoot back up to 28ms which is so sad
<isabella> and i still don't know how to draw sprites fast enough for it to be playable
<isabella> and i've given up on textures
<isabella> and i've mostly given up on shading the floor
<isabella> it's just so much work to get bash to calculate stuff fast enough...
<isabella> like each frame at that resolution is ~640kb of data that goes to the terminal, and i'm buffering it too so it's 640kb * 3 (write to file + read from file + write to term) * 30fps = 57mb/s in just i/o, which is a significant amount for bash
<isabella> but at least it was fun to work on :)
<isabella> i've only done a few 3d things in uni and a visual thing for work once (...right before the company went bankrupt lol)
<isabella> so this was all new for me
<isabella> profiling bash with perf has led me absolutely nowhere. for instance after i saw this https://i.imgur.com/RhMZ5hl.png i worked to knock the most expensive function down a notch or 7, and i did https://i.imgur.com/AcdBL5s.png and the improvement was so small it wasn't even measurable
<isabella> profiling via debug traps or even set -x was also a dead end because if your code is already decently optimised they add a ton of overhead in comparison
<isabella> i wish there were better tools
<isabella> even replacing all the maths to use shifts instead of division by 100k was basically no improvement because bash is just overwhelmingly too slow in everything
<isabella> sdomi: but if you do have a look at the code, please let me know if you see performance improvements!
<sdomi> i will look at some point soon ^^
<sdomi> plus, i want to try porting it against x11.sh, as i wrote before
<isabella> i think that might be significantly easier if you have actual drawing primitives instead of writing everything with characters
<isabella> would be cool to see
<Maja> re sql: maybe prepared statements?
<sdomi> Maja: god i forgot the usecase already, i'm so good at it
<sdomi> ah, right! i wanted to unbreak akkoma search by replacing that whole path in nginx to a httpsh app which does *just search*
<sdomi> so idk how much i can do with prepared statements. i still need to sanitize my input (and I guess I could just `s/[^a-zA-Z0-9 ]//g`)
<sdomi> the query would look something like this: `SELECT data#>'{actor}', data#>'{content}' FROM objects WHERE data#>>'{type}' = 'Note' AND data#>>'{actor}' ~ '<content here>' AND data#>>'{content}' ~ '<content here>' LIMIT 10;`
<sdomi> so your idea with prepared statements may make sense knowing... the complexity
<sdomi> i have been informed what prepared statements are in this context