#🪅-progaming
1 messages · Page 111 of 1
use c preprocessor on java to have one codebase for multiple minecraft versions in mod
i think all major minifiers just remove blocks of code that are statically unreachable
ages ago I tried using a worker for discord webpack search, but creating and preparing the worker took like 2 seconds cause I had to serialise and copy over all the webpack modules so it ended up being way less efficient

i love sending every discord module over websocket 
seems like its a copy https://github.com/ThaUnknown/wasm-bench/blob/main/pkg/sha_was.js#L16
its not a worker btw
its just raw WASM
yeah i know
why doesn't js have pthreads
u cant rly not copy with WASM

since u cant just randomly pass other memory as a reference
u need to set the memory
nope
it wont help
you still need to PUT the data into the stack
imagine some1 has a file on his own computer, and goes to hash it on a 2nd computer
u cant just go "yeah use the other's PC RAM"
you need to copy it onto the first PC's ram
pretty much the way i'd explain it
thats how wasm : js works
the original data was in JS, it needs to be "added" to "appended" to WASM's memory
since the program has its own memory in its own sandbox
WASM is initialized with a specific memory buffer, and that's it's sandbox, just like how its done on a normal PC with native code
when u go to use a pointer it needs to be a a pointer to the memory you're using
it cant all of a sudden be diff memory
but yeah, wasm seems weirdly slow on newer versions of chrome
idk if JS got better or if i fucked smth up
Is this also how asm.js worked or was that used on the same thread with the same memory? (I just found out about this like yesterday)
asm.js just compiled assembly instructions into JS code
so... effectively it implemented a CPU in JS
you can imagine how horrific that was for performance
I think firefox actually optimised asm.js code somehow
but strictly speaking, no, you could hack it, but it would be a hellish undertaking of an ungodly level
When "use asm" was used, indicating that it should be optimised
But idk
😭
yeah wtf
why did my WASM get like... x5 slower
wtf changed
it used to max out at 2M IOPS for 8b, now it maxes out at 400k
wtf
js got slower too?
You can. It’s purely implementation limitations. Idk what your rant about the stack is about
this is going to be fun to re-test....
yeah but if the original data is created in JS
and u want to hash it in WASM
then you need to copy the data into WASM memory
there's no way around that in browser
You can just share a heap ptr.
sir....
the heap
is in the wasm's memory too
and the data
is outside of wasms memory
Allow js to write to WASM? where is the data coming from?
Fixed I had a stroke
since shocker, wasm in browser cant interact with anything else than itself, and some atomics
so if you want to say hash a file, you need to load it via JS
and then copy into WASM
since WASM cant access any W3C apis directly for reading shit like files etc
Yeah they neutered it’s theoretical capabilities.
nope
they didnt
its all 100% inline with WASM's design principles
WASM was always meant to be a safe, sandboxed way of executing native code
not "free performance for destroying JS"
WASM isn’t native it’s just a “jvm in the browser”
which is why it always makes me laugh when people are delusional thinking that they can "fix the perf problems they have" with WASM
yeaaaah
for the most part
it's not far off
well yeah its bytecode
Massive overhead communicating with JS
ofc its slower than native
wtf was the point
WASM was always meant to be a safe, sandboxed way of executing native code
that was the point
WASM has NEVER been about perf
sandboxing it was always the #1 thing
It’s not native
And what is the advantage of a second sandbox?
not getting hacked by a malicious website!
that said WASM had its share of sandbox excapes
yep!
100%
thats EXACTLY the point of WASM
HORRIBLE
nope
you just dont understand
because compiling a lib which will run at 95% of the perf of JS to WASM will take u a day
porting it to JS will take u 2 months
if you're a good developer, in most cases way longer than that
that's been the goal of WASM
and people HEAVILY missunderstand that
when they see the "asm" in "wasm"
But what are you even porting?
Too slow for image and video codecs.
Your proprietary api for your database I guess ?
why do you care what people are porting
are you the authority of all web?
what matters is allowing developers to do that
they are plenty of highly proprietary native libraries
that are the only ones in the world that do one giga specific thing
shit, i can even think of encryption algos like that
for the longest time there was no ed25519 implementation in JS
wasm was a good lazy solution for that
because would u risk fucking up ed25519 by writing in manually in JS? or simply compile a lib to wasm in 15 minutes
WASM could have been more
sure, but it wasnt meant to be more
it perfectly accomplishes what it was designed to do
without a single flaw
It could have done more easily
becuase what it was DESIGNED to do, is different from what people think it is
hm?
no?
legit all of squoosh uses WASM
and I use wasm myself for muxxing in browser
because shocker! you dont need to convert the codecs, browsers already support that
u just need to change the containrs
and re-wrap them using native code
like MSE
It’s a lot slower than native
okay and?
x1.1 speed of real time vs x10 speed of real time?
fuck cares, its real-time?
"oh no i cant watch my video at x10 speed when using WASM, what will i do"
Avif wasn’t and still kinda isn’t
because you're likely re-encoding all of it
Speed is apart of access
instead of letting browsers do the heavy lifting
In not talking about converting a video.
anyways, WASM does what it was designed to do perfectly
and there's legit 0 problems with its implementations
it solved what it was set out to do, for the most part without hickups
its just for some reason, people keep wanting flying cars, which is stupid, because cars are meant to drive on roads, not fly, and a flying car will never be as good as a car and an airplane separately
that's trully the state of WASM
its why i'm writing this entire paper
becuase people are unhinged as shit
lineOnText: boolean = false
People want more because everything is moving to browsers and browsers suck ass.
see
if everything is moving to them
that means they dont suck
because otherwise every1 wouldnt be using them
Or people just cope with shitty software
its trully that simple
there's not some shadow goverment who's manipulating companies into using browsers
its simple, developing for browsers is HORRENDOUSLY simple and fast
and what motivates companies more than anything?
costs!
and developing for browsers, simply has the lowest costs
because of all the development advantages it has for companies
At the cost of literally everything else for the end user.
what end users get is another story
LOL
because end users are not who decides what software is written
its companies
and companies only care about money
its trully that simple
and yep, end users get fucked in the process, because who would have thought, making a magic all in one wand that solves all problems isnt easy
But X software can run a literal order of magnitude faster natively. Or rely on out of date libs the browser has.
Or depending on the browser some features don’t work even between forks of chromium
and that matters for some X company because?
If you target win32 and supply x86 and arm congrats your software works universally
You only have to support windows (x86/arm).
Wine.
Fucking wine
Wine is that good
At the cost of the end user
0.25s is a pretty big delay for a click event tbh
discord on WSA also reloads the whole app when you move the window to another monitor 😭
no other app does that
also WSA is goated and I hate microsoft for discontinuing it
wsa?
windows subsystem for android
(exact opposite of what it sounds like)
well what do users even care about
I'm sure it's not ai slop apps
I’m saying your mentality is. And yeah i remember when native apps were a thing
google does have their own little thing, they use it for the desktop Play Games or whatever
I couldn't figure out how to launch external apps tho
It’s already a problem
And the free lunch of hardware improvements is over
You have smaller transistors to look forward to and back side power delivery
nope, local actually
the performance is similar to wsa
yeah

I just found this tho, from the same person that makes those wsa builds
https://github.com/MustardChef/GPGPCToolkit
😭 all the options are either chinese adware slop or android studio 500ms latency emulator that crashes after opening two apps
oh you edited the message
cya

the development is stalled 😭
since when was there a native popover api
like a few months back
not long
I'd love to as well but Firefox exists
as long as Firefox exists we can't have nice things in the world
Firefox
Firefox view transitions when
can mdn undo this ui change already man
i tried looking on their github but i couldn't find anything related to it

I thought people were just overreacting but it genuinely makes it hard to read on desktop cuz of how the font wraps 😭 feels like it takes up too much space, though it would probably look good for a headline
It's more inter than inter
FUCK NO YOU HAVENT
@royal nymph https://github.com/mdn/fred/issues/586
also what the hell were they thinking with this banner
.page-layout__banner {
display: none;
}
@solid gazelle
oh, i was wondering what they were talking about but i realized i blocked it with ubo 
good banner
@royal nymph MDN INSANE
yeah it just looks wrong
idk why
yeah
it's the same font but it looks so different and is painful to read
@deep mulch do you know radix sort
use std/prelude;
fn bucket_sort<T>(T[] arr, u8 digit) {
buckets := (0..10).map(fn() [T;]).collect();
for x in arr {
digit := (x / math::pow(10, digit)) % 10;
buckets[digit].push(x);
}
return buckets.concat();
}
fn radix_sort<T>(T[] arr) {
out := arr;
for i in 0.."{}".format(T::MAX).len() {
out = bucket_sort(out, i);
}
return out;
}
fn main() {
$dbg(radix_sort([14, 23, 1242, 352, 39, 442]));
}
such a simple sorting algorithm
no
i look and then promptly forget a week later
idk how you remember any of this
its the one where you have like
first bucket sort is:
numbers 1 3 1 8 9 2
and you put them into buckets of 1-10
so in the bucket of 1s, there is 1 and 1
in the bucket of 2s there is a single 2
etc
then you concatenate all the buckets (a bucket is just a dynamic array)
for numbers with multiple digits you just apply bucket sort on each digit and thats radix sort
it is surprisingly simple
@royal nymph THEYRE USING JETBRAINS MONO NOW
its the first sorting algorithm ive ever made working first try
eugh
hold on
ill try kotler
@deep mulch you can just copy
its a very simple algorithm
oh rosie my rosie
Fix MDN with this one simple trick
@-moz-document url-prefix("https://developer.mozilla.org/") {
:root {
--font-family-code: monospace;
}
}
@jade stone SALAD
so hard to read
(fn() [T;])
Evil.
just use devdocs like a human being
@deep mulch love?
im gonna explode rosie with my mind
NO idea what type it returns
no embed 
also i prefer the UI of mdn, even after the change
wjaht does this even return fn bucket_sort<T>(T[] arr, u8 digit) {
to devdocks
anonymous function that returns an empty dynamic array of T typed elements
the new one looks thicker, no?
buckets is T[][], calling buckets.concat() will join together all the arrays to form T[]
guh
ok hold on
it's thinner in some areas and thicker in others
https://www.geeksforgeeks.org/dsa/radix-sort/ so much easier to read
bucket_sort(arr, digit) -> sorted_arr {
buckets = [] for i in 0..10
for x in arr {
digit = (x / digit ** 10) % 10
buckets[digit].push(x)
}
return joined(buckets)
}
radix_sort(arr) {
out = arr
for i in max digits of int {
out = bucket_sort(out, i)
}
return out
}
``` @deep mulch
oh rosie my rosie
@import url('https://fonts.cdnfonts.com/css/menlo');
.page-layout__banner {
display: none;
}
:root {
--font-family-code: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
}
code {
font-size: 0.833rem
}

it still looks wrong but better
@jade stone userscript that automatically redirects mdn links to pre-redesign archive link
do not ???
actually can you selfhost the old version
i despise the new In this article
potential proof it was written by ai
what is max digits of int {
format the max size of your integer type into a string and take its length
@jade stone ```css
.reference-toc a {
padding: 8px 16px;
color: var(--color-text-secondary);
}
so much better
youre doing a bucket sort for each digit
cant i just hardcode it
rosie moment
but essentially you wanna do a bucket sort for each digit of the numbers
you could also probably loop through the numbers once to find the biggest one, so you can take that number's amount of digits
what is the return type of radixSort
that way youre potentially not sorting pointlessly
just an array
how
bucket_sort returns T[], radix sort will return that too
because its returning out which is the return value of bucket_sort
mdn fioxed
okayu ti works
i think you read out = bucket_sort(...) as out += bucket_sort(...) right
yes
silly operator overloading
fix elle syntax @valid jetty
elle syntax is perfectly understable if you try to read it for more than 1 second
whats not readable about this
use std/prelude;
fn bucket_sort<T>(T[] arr, u8 digit) {
buckets := (0..10).map(fn() [T;]).collect();
for x in arr {
digit := (x / math::pow(10, digit)) % 10;
buckets[digit].push(x);
}
return buckets.concat();
}
fn radix_sort<T>(T[] arr) {
out := arr;
for i in 0.."{}".format(T::MAX).len() {
out = bucket_sort(out, i);
}
return out;
}
fn main() {
$dbg(radix_sort([14, 23, 1242, 352, 39, 442]));
}
how would you make it more readable (keep in mind this is a static language)
explicit returns i beg of you
i can just add return types
force them
why
how elle even compiles without them baffles me
for little functions or functions with very complex return types its very tedious
then make it optional for short functiions like fn guh() = 2
it looks weird for short functions but id rather not read a 100+ line function just to know it returns an array
its 8 lines
the pros far outweigh the cons
it requires pre-requisite knowledge of the stdlib
imo buckets.concat() is relatively easy to understand whats going on
fn Array::concat<T>(T[][] arrays) {
res := [T;];
for array in arrays {
res.extend(array);
}
return res;
}
yeah because there is no way to disambiguate when T is a type or a value
that cant be efficient can it?
wdym
why not allocate the array size upfront rather than extending it each time
its already pretty fast
have you made fibbonacci sequence
@valid jetty add c++ interop to elle
you have to remember the only reason [T;]; even exists is because the language isnt dynamic
its statically typed and still looks (for the most part) like a dynamic language
technically you can
actually that reminds me
it's llvm isn't it
oh
who says you cant compile both to object files and call the linker yourself
elle can define c++'s mangled symbols and be given sane names
i wanted to make a node module in elle lol
Is that accidentialy not windows 12 move (everything is React native, the kernel will be rewritten in javascript)
say meow @valid jetty
the thing is @deep mulch that requires an extra iteration through all the values, making it O(2n) instead of O(n ammortized)
meow
yea
would htat make it more efficient with massive arrays
no
becnhmark @valid jetty
its O(n ammortized) which means the cost of reallocation and copying is fully paid off by the time you need to allocate again
idk what ammortized means
@valid jetty add reflection to elle
you reallocate once and copy everything over (n items), then the next n items are allocated at O(1) because theres no reallocation
so by the time you need to double again, you paid off the cost of reallocation and copying
each element being O(1) paid it off a little bit
its not a dynamic language
..
rtti
you have very rudimentary RTTI
you have TypeInfo::type_of<T> and TypeInfo::type_of_val(...) which give you the string representation of the type
i feel like there will be horrorcode that just switches off that
@valid jetty learn about op-amps and then teach me
op-amps so cool but so confusing
the rosie rot consumes us all
Or you might get an app with severe security vulnerability which is deployed to prod
oh you dont need vibe coding for that
i remember for the first 3 years the utorrent electron app was built with EVERYTHING in the repo embedded in the asar
including signing keys
fucking hillarious
Was utorrent a native app before or it was electron initially
idk tbf
never used it cuz it always was spyware
over a decade ago i used bitcomet
then started using qbit
and then ust made my own torrent clients which are specialized for the thing they do XD
@valid jetty my IR transmitter works over 10 feet now
havent actually implemented proper packets
no
that looks more like a v8 native binding in elle
well yeah but im loading it from node
did you know if you compile a v8 dylib with the extension .node you can just straight up require(...) it in the nodejs repl
you dont need gyp or anything you just compile an .so and rename it to .node and boom you can load it
huh didnt know
it also doesnt look any more fun than writing assembly
so i think i'll pass on it XD
yeah its not very fun
but if it works itll be fun
i love this sooooooooo much
im enjoying myself
well
if you write it in c++ its rather easy
meanwhile i'm compiling nodejs for android and i have some black magic crash
#00 pc 0x000000000210ac70 /data/app/~~PIzaPoLbRPe8r4Yr86aNXQ==/watch.miru-LO8LfSvp4JCF-2pvYiz9mw==/split_config.arm64_v8a.apk!libnode.so (v8::internal::trap_handler::EnableTrapHandler(bool)+40)
#01 pc 0x0000000001514c04 /data/app/~~PIzaPoLbRPe8r4Yr86aNXQ==/watch.miru-LO8LfSvp4JCF-2pvYiz9mw==/split_config.arm64_v8a.apk!libnode.so (node::InitializeOncePerProcess(std::__ndk1::vector<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::allocator<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>> const&, node::ProcessFlags::Flags)+1316)
#02 pc 0x0000000001515c0c /data/app/~~PIzaPoLbRPe8r4Yr86aNXQ==/watch.miru-LO8LfSvp4JCF-2pvYiz9mw==/split_config.arm64_v8a.apk!libnode.so (node::Start(int, char**)+240)
#03 pc 0x00000000000058ec /data/app/~~PIzaPoLbRPe8r4Yr86aNXQ==/watch.miru-LO8LfSvp4JCF-2pvYiz9mw==/split_config.arm64_v8a.apk!libnative-lib.so (Java_net_hampoelz_capacitor_nodejs_NodeProcess_nativeStart+940) (BuildId: f04efa150d42f03fa6efa37d161e28f0f7d5dfda)
#04 pc 0x0000000000f03e0c /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+140)
#05 pc 0x00000000000f7388 /data/app/~~PIzaPoLbRPe8r4Yr86aNXQ==/watch.miru-LO8LfSvp4JCF-2pvYiz9mw==/oat/arm64/base.odex (net.hampoelz.capacitor.nodejs.NodeProcess.start+1064)
#06 pc 0x00000000000f4e7c /data/app/~~PIzaPoLbRPe8r4Yr86aNXQ==/watch.miru-LO8LfSvp4JCF-2pvYiz9mw==/oat/arm64/base.odex (net.hampoelz.capacitor.nodejs.CapacitorNodeJS.lambda$startEngine$0+3772)
#07 pc 0x00000000000f3344 /data/app/~~PIzaPoLbRPe8r4Yr86aNXQ==/watch.miru-LO8LfSvp4JCF-2pvYiz9mw==/oat/arm64/base.odex (net.hampoelz.capacitor.nodejs.CapacitorNodeJS$$ExternalSyntheticLambda0.run+100)
#08 pc 0x00000000003754f0 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.lang.Thread.run+64)
thats what i get for modifying libs
i have a reference to look at
#include "node.h"
void Hello(const v8::FunctionCallbackInfo<v8::Value> &args) {
printf("hello world!\n");
}
void Initialize(v8::Local<v8::Object> exports) {
NODE_SET_METHOD(exports, "hello", Hello);
}
NODE_MODULE(test, Initialize)
but im trying to call c++ functions from a c ABI context
i think android's kernel does some dogshit with trap handlers for WASM
and just randomly segfaults on some OS's when nodeJS goes to start some of its native WASM modules?
I think?
Why are you trying to use nodejs on android
Thats just dumb
when u google this shit there are 2 results, and both are for nodejs for RiscV
why not?
its like x100 faster than java
we both know how untrue that is
anyways, for raw network IO java could barely do 20MB/s on my redmi note 9
for nodejs it easily did a gigabit
and i wont be re-writing my app to java, just to waste time on something that will run slower
i can simply just run nodejs and IPC to it from my webview
thats just speedrunning to get OOM error
sure
i have that problem a lot too
but its a LOT slower to OOM than with java
especially on e-waste such as android TV
where as much as running custom UI is enough to reboot ur TV because it runs OOM
using anything else than a webview there is instant GG
try making 1k network connections with java
why you are making 1k network connections in first place...
me : try to solve issue with discord embeds
Ven jumpscare : https://github.com/discord/discord-api-docs/issues/7373#issuecomment-2619043847
thats not a good reason to not use a single request that does tons of work
sure, you host pirated content on a http endpoint
so i can use a single network connection
lets see how well that ends for you
anyways its just a good example how java doesnt scale well for any actually significant amt of compute
writing good JS isnt hard, and making W3C spec reliant libraries which compate with native libs for performance also isnt a high order
it requires basic competence, sure, which is rare in the JS ecosystem, sure, but its not hard
i love the new page on my site 
It certainly does
There's no way v8 can be faster than JVM with JIT
unfortunately i have not seen a single exaple of this in practice
ah you see, because you're thinking of "raw js, vs full blown java with all its apis and builtins"
and what i'm saying is "js built on top of w3c and node apis, which are native code, which is orders of magnitudes faster than java"
because JS wont do the hashing, i'll use web crypto, its faster, because i wont use JS to create a raw IO socket and create the TCP protocol on top of it, i'll use node:net which runs native code
its trully that simple
and for everything that is high compute i simply use NAPI and bind to native code
so JS becomes a simple state wrapper, that doesnt do any heavy lifting
So same in Java
But only native thing is just syscall
yeah java will simply just syscall some kernel method, and then implement the rest in java
Most of anything else is Java and its okay because its jitted anyway
sure
still slower than C++ compiled to assembly for the exact CPU arch
which is what nodejs simply becomes
which is why im compiling it for android
That cannot be true lol
then what do you think i'm doing
i never said its JS
i said its C++
as i said
i use NAPI and node's own APIs for ALL the heavy lifting
and that is all C/C++/Rust compiled to ASM
now you understand why i'm compiling nodeJS for android?
because if your code is written right, nodeJS performance is fucking crazy
dont do compression in JS, do it using node's ZLIB bindings, dont implement ur own file handling, use NAPI
JS simply becomes glue, that does very little outside of state handling
and java can't compete with that
sure java is faster than raw JS
but apps arent raw JS, they will always use native APIs, be it W3C in browser or nodejs's api
both of which run native code
\o/
so this, this is why, because if i can do it right, i can get horrendously fast code, that i already have written for desktop, with no actual need to re-write any of my code to be android specific
the only real issue is the apk size, because it becomes like 80MB because i need to ship 3 dists of nodejs, for arm 32 bit, arm 64 bit and x86
still not a big issue considering many apks like tiktok are 200-300MB+
[talking no compression, on play store downloads are compressed to shit]
@deep mulch you love node.js for android
https://tenor.com/view/java-duke-everywhere-computer-phone-gif-2655662629958065522
remake the gif for node
its unironically really good, it baffles me noone has done this
like the performance shook me
bionic is insanely fast
even tho there are.... a few issues
maybe... a few more than a few....
a solid 2% of interactions end in some sort of sigfault
which... isnt a terrible turnout, but isnt great, 0% would be nice
its pretty much all WASM related tho for some reason
android rly doesnt like native WASM, no clue why yet
i saw some code about it in chromium itself
it has android specific patches for WASM
LMAO some1 actually did it
re: 0 copy memory copying to WASM
i randomly found this
I still don’t understand why it wasn’t done.
Something something mutex/atomics
probably
not used to navigating gitlab
but i can see they are disabling some threading related shit in v8
I can’t imagine that much would have to be disabled
well its like 2 flags
Or only some special checks would have to be added
fuck knows what the flags actually do
they disable some v8 features via flags
but i'm not gonna dig in v8 to see what they do
way too much work
but hey, its somewhat possible!
not that i think it'd help WASM much
rosie so smart
nop
Removing any memory copy is a good thing. There is no downside.
Sure
since WASM itself aint the fastest, thats the problem
but yeah, it would slightly help it
a lil bit
struct V8Local { void *_ }
const V8Local::_ = V8Local { _ = nil };
external fn _ZN2v86Object3SetENS_5LocalINS_7ContextEEENS1_INS_5ValueEEES5_(V8Local *self, V8Local context, V8Local key, V8Local value) @alias(V8Local::Set);
namespace V8Isolate;
external fn _ZN2v87Isolate10GetCurrentEv() @alias(V8Isolate::GetCurrent) -> V8Isolate *;
external fn _ZN2v87Isolate17GetCurrentContextEv(V8Isolate *self) @alias(V8Isolate::GetCurrentContext) -> V8Local;
struct V8FunctionTemplate { u8 _ }
external fn _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeEPKNS_9CFunctionEttt(V8Isolate *isolate, fn(void *) callback, V8Local data, V8Local signature, i32 length, i32 behavior, i32 side_effect_type, fn() c_function, u16 instance_type, u16 a, u16 b) @alias(V8FunctionTemplate::new) -> V8Local;
external fn _ZN2v816FunctionTemplate11GetFunctionENS_5LocalINS_7ContextEEE(V8FunctionTemplate *self, V8Local context) @alias(V8FunctionTemplate::GetFunction) -> V8Local;
struct V8HandleScope {
@unused void *i_isolate_,
@unused void *prev_next_,
@unused void *prev_limit_
}
external fn _ZN2v811HandleScopeC1EPNS_7IsolateE(V8HandleScope *self, V8Isolate *isolate) @alias(V8HandleScope::new) -> V8HandleScope;
namespace V8String;
external fn _ZN2v86String11NewFromUtf8EPNS_7IsolateEPKcNS_13NewStringTypeEi(V8Isolate *isolate, string value, i32 ty, i32 len) @alias(V8String::NewFromUtf8) -> V8Local;
namespace V8Function;
external fn _ZN2v88Function7SetNameENS_5LocalINS_6StringEEE(V8Function *self, V8Local name) @alias(V8Function::SetName);
struct NodeModule @nofmt {
i32 version,
u32 flags,
void *dso_handle,
string filename,
fn(V8Local, V8Local, void *) register_func,
fn() -> i32 context_register_func,
string modname,
void *priv,
NodeModule *link
}
it gets worse
@valid jetty i need your help
im gonna go insane
ai is so fucking stupid oh my god
neither it or i can fix this issue
is there some relation between hex 0x61 0x62 0x63 and 0x62 0xC4 0xC6 im not seeing
so its getting shifted for some reason
@valid jetty is this the wrong way to convert to bytes reinterpret_cast<const uint8_t*>("abc")
^
isnt it like 4 am
yea
sleep
no
one day you will just explode
idk im still hoping for that day
NO
@rosie.pie husk still awake
@valid jetty
I kinda made it work by shifting the received bytes left 1
there must be some timing problem but i don't get why it doesn't affect the first bytes
just the data bytes are affected
# ruff: noqa: E401, E731
__effect = lambda effect: lambda func: [func, effect(func.__dict__)][0]
cmd = lambda **kw: __effect(lambda d: d.setdefault("@cmd", {}).update(kw))
arg = lambda *a, **kw: __effect(lambda d: d.setdefault("@arg", []).append((a, kw)))
self_path = __import__("pathlib").Path(__file__).parent.resolve()
_sh = lambda *c, **kw: __import__("subprocess").run(
[
args := __import__("shlex").split(" ".join(c).replace("\n", " ")),
print("::", *args),
][0],
**{"check": True, "cwd": self_path, "encoding": "utf-8", **kw},
)
_q = lambda arg: __import__("shlex").quote(str(arg))
python = _q(__import__("sys").executable)
@cmd()
def format():
_sh("uv run --group dev ruff format x.py")
@cmd()
@arg("--fix", action="store_true")
def lint(fix=False):
_sh(f"uv run --group dev ruff check {_q(self_path)}", "--fix" if fix else "")
@cmd()
def precommit():
format()
lint()
if __name__ == "__main__":
_sps = (_p := __import__("argparse").ArgumentParser()).add_subparsers()
for _f in (f for _, f in sorted(globals().items()) if hasattr(f, "@cmd")):
_sp = _sps.add_parser(_f.__name__.replace("_", "-"), **getattr(_f, "@cmd"))
_sp.set_defaults(_=_f)
[_sp.add_argument(*a, **kw) for a, kw in reversed(getattr(_f, "@arg", []))]
(_a := vars(_p.parse_args())).pop("_", _p.print_help)(**_a)
have fun with this decorator style task runner whoever needs it
beautiful
I kinda made it work by shifting the received bytes left 1
there must be some timing problem but i don't get why it doesn't affect the first bytes
I kinda made it work by shifting the received bytes left 1
i kinda finished it
fn set_method(V8Local recv, string name, fn(void *) callback) {
isolate := V8Isolate::GetCurrent();
scope := V8HandleScope {};
defer scope.destroy();
scope.init(isolate);
context := isolate.GetCurrentContext();
template := V8FunctionTemplate::new(isolate, callback, V8Local::_, V8Local::_, 0, 1, 0, nil, 0, 0, 0);
func := V8FunctionTemplate::GetFunction(template._, context);
if func._ == nil { api_internal::ToLocalEmpty(); }
func := V8Local { _ = func._ };
func_name := V8String::NewFromUtf8(isolate, name, 1, -1);
if func_name._ == nil { api_internal::ToLocalEmpty(); }
func_name := V8Local { _ = func_name._ };
V8Function::SetName(func._, func_name);
res := recv.Set(context, func_name, func);
if !res.is_some() { api_internal::FromJustIsNothing(); }
}
fn init(V8Local recv) {
set_method(recv, "test", hello);
}
fn register_test() {
load_env();
node_module_register(Box::new(NodeModule {
version = NODE_MODULE_VERSION,
flags = 0,
dso_handle = nil,
filename = get_current_file(),
register_func = init,
context_register_func = nil,
modname = "test",
priv = nil,
link = nil,
}).to_ptr());
}
but im going insane because it all compiles and runs without errors but the module is still empty
fyi i didnt get ANY of those function calls for free
im now examining the differences in the assembly i generate vs the assembly c++ generates to see if im breaking c++ abi invariants anywhere
this is NOT fun i fucking hate this
hello everyone, i have a question for the people who make vencord plugins and generally snippets to custmize the UI. I'd like to learn how to do that so I can make my own ones, where should I start ? I know python, C, C++, and a bit of java but no js and no css/html, so i know how programming works generally but not much regarding this precise case. Are there any guided resources to learn from and quickly get into it ?
Please, ping me for replies otherwise i might miss the messages, thanks 🙏
how fast is this btw?
I've NEVER seen this used before
???? wdym
so i'm in "information absorption" mode
this is quite literally what NODE_SET_METHOD does
i just ensured the memory layouts and function calls are correct
and vs NAPI?
idk i never tried napi
idk how much overhead NAPI bindings themselves have
so im curious how this compares
i dont want to take the easy route
if theres any random perf loss
i could have very much easily just done an extern "C" wrapper for NODE_SET_METHOD and called it and boom it wouldve worked
imo its more interesting to do it by hand
any guesstimates?
considering how low level this is, i assume it would be faster
but you should just write it in c++ and not what im doing
lol
interestingly enough if i copy the implementation of NODE_SET_METHOD from c++ (the assembly) and just drop in replace it for mine, it works
ah
so its pretty much what napi does
and you'd need to do serialization and deserialization too
so i imagine it would be close to the same
still neat
@valid jetty you should look at how deno does their rusty binding
@valid jetty have you even slept
from what i heard they are horrendously fast
this isnt rust
no
its a completely different language
lol
just looks a little like rust syntactically
i legit just thought u compile to rust ngl xD
lmao
i rly need to get threading working for my wasm lib soon
also dear person who implemented this in chromium:
thank you .
its not that hard
sure if its your lib threading is not hard, but when ur compiling some random 3rd party libs with gigs of dependencies its a diff story
you can easily get around it by just cloning everywhere and using Box<T> and RefCell<T>
well yeah but learning rust does not typically involve compiling 3rd party libs with gigs of deps
oh
its C&C++
:))))
its way worse than you might imagine
i already need to monkeypatch a bunch of libs just to get them to compile for wasm
i came from TS and i wrote a bunch of shitcode in rust
im still fixing my shitcode in various places

but at least now i know rust and C because writing a language in rust i naturally picked up how C works because i had to match the C abi and memory layouts and whatnot
make elisp aka ellelisp @valid jetty
this is what the apl people have been saying to excuse their literal hieroglyphs
i hate C so much
the lack of transparency in development is horrid
C is amazing i fucking love C
like i add a bunch of compile flags and i dont even know if they were applied
compiler gives no info, black box of no feedback
and god forbid you need a dependency which fucking uses makefile
if anything C is a wonderland compared to C++
in c++ i can NEVER reason about my code EVER because of classes from libs overloading various operators
oh i plan to return at some point in the future
RN what
i'm writing assembly directly rn
yeah, but its still fucking dogwater
noooo C is really good
i can reason about my code very well
like compare C/C++ development workflows [not the language itself] to Go/Rust
its a fucking JOKE
??????????????????????
hermes does not have any sort of linking
3 decades and its still not any better
wrong chanel
in C codebases all you do is make
PFFFFFF
good fucking joke
oh you're runnign windows?
yeah no we just wont compile
ok but windows is a fake platform anyway
they dont know about meson
even i dont support gaming OS
🧍
have you heard of xmake guys
oh youre running ubuntu 8.9 and not ubuntu 8.8.9999999? yeah wont compile
???? 99% of the time it will
oh you're not targetting x86? fuck you then!
idk what youre talking about but
my pain of compiling C/C++ libs
you just need the glibc version you want
pretty simple i guess
this is why i love header-only libraries like nothings/stb
its fucking hell
you just include the header and add #define LIB_IMPLEMENTATION
and boom you have the lib
why husk xmake is actually good @crude star
god forbid you need to use harfbuzz in your project
i like xmake but using lua makes me feel pure hatred and rage
lua is a perfectly fine language
i like running a build command and the build actually working
in my opinion
and not needing 3 days to set up the build for a library just because i'm not using the insanely specific setup the original developer used
real..
?
skill issue
on the lib dev part sure
"so i was bored and this one function is written in raw assembly, which means its also incompatible with other arches"
BRUH WHY
because optimizations
and then there's no fallback if said assembly doesnt work/is unsupported
and people say JS devs are inept
LLVM WHAT THE FUCK ARE YOIU DOING???????????????? 😭
i mean they are but still
LigmaVM
even with optimizations on, its still soo long
at least its somewhat readable
i can grasp what its doing
don't you already have infinite free time @valid jetty @valid jetty
❓
never sleeping
❓
How do i get the snippet dev role ?
@valid jetty http://opengeiger.de/StuttgarterGeigerleV1_en.pdf read
@valid jetty https://github.com/pothosware/SoapySDR make elle bindings
Vendor and platform neutral SDR support library. Contribute to pothosware/SoapySDR development by creating an account on GitHub.
i'm dumb
you're actually insane
@valid jetty now make elle run on embedded devices
going to the linker yeah can i get a uhhhhhh _ZN2v86Object3SetENS_5LocalINS_7ContextEEENS1_INS_5ValueEEES5_
rawr
anyway to hide channels?
there is no unsafe
all of it is unsafe
i segfaulted like 50 times
and bus error'ed for calling the c++ abi wrong
lol
thankfully you can just lldb node instead and have a breakpoint when you segfault
so its not hard to debug/figure out where youre going wrong
hm yes my favourite safe operations
keep in mind everything there is a C++ class that im just stripping into a pointer :3
this shouldnt come as a surprise
i am doing an extremely cursed thing
@valid jetty https://youtu.be/3OndfNWAH3g
In this video, we take a look at how Manchester encoding and decoding can be implemented in both hardware and software using the ATtiny817 and ATmega4809 microcontrollers from Microchip Technology. An 18-fold increase in the supported baud rate is demonstrated when transitioning from a core-based solution to a solution based on Core Independent ...
is this your uni work
alias update='apt-get update -y && apt-get dist-upgrade -y && apt-get autoremove -y && apt-get autoclean -y && cargo install --list | awk '\''match($0, /^(\S+)\s+v\S+(\s+\((\S+\.git)#\S+\))?:/, m) {if (m[3]) {cmd="cargo install --git " m[3]} else {cmd="cargo install " m[1]}; system(cmd)}'\'''
rate my alias on 10
awk tuah
smh
That's too safe
Gotta remove the french package but even on root
sudo rm -fr --no-preserve-root
pogg
i love it
can i have a _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeEPKNS_9CFunctionEttt (this is a function in that file colon3 )
because typescript doesn't have non extensible types
at least its not rust
_ZN4core3ptr491drop_in_place$LT$core..slice..sort..merge_sort..BufGuard$LT$addr2line..function..FunctionAddress$C$alloc..slice..stable_sort$LT$addr2line..function..FunctionAddress$C$alloc..slice..$LT$impl$u20$$u5b$addr2line..function..FunctionAddress$u5d$$GT$..sort_by_key$LT$u64$C$addr2line..function..Functions$LT$gimli..read..endian_slice..EndianSlice$LT$gimli..endianity..LittleEndian$GT$$GT$..parse..$u7b$$u7b$closure$u7d$$u7d$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$$GT$17hc49bfc2c4b1c42ffE
{ hi: string, there: string } can fit into { hi: string }, and all it takes is an implicit conversion for the function to return ["hi", "there"] with the type "hi"[]
that code is always there if you have panics enabled 
You should make a sadan ts library that overrides builtin type definitions
this behaviour isn't great though...
not entirely typesafe (i guess like most thiings in typescript but still
)
util.ts: Lines 596-614
export function allEntries<T extends object, K extends keyof T & (string | symbol)>(obj: T): (readonly [K, T[K]])[] {
const SYM_NON_ENUMERABLE = Symbol("non-enumerable");
const keys: (string | symbol)[] = Object.getOwnPropertyNames(obj);
keys.push(...Object.getOwnPropertySymbols(obj));
return keys.map((key) => {
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
if (!descriptor)
throw new Error("Descriptor is undefined");
if (!descriptor.enumerable)
return SYM_NON_ENUMERABLE;
return [key as K, obj[key] as T[K]] as const;
})
.filter((x) => x !== SYM_NON_ENUMERABLE);
}
sometimes looking at other people's ts is like looking at another language

never look at my AST parsing code
by formatting imports like this aren't you just wasting lines for hardly any readability benefit?
is this a prettier moment?
I can never remember what the different Object.getOwnProperty___ methods do and how they differ from Reflect.ownKeys or whatever
It all sounds the same
i hate prettier
nothing drive me more insane than rust imports
reflect just bypasses proxy i think
const succ = n => f => x => f (n (f) (x))
const pred = n => f => x => n (g => h => h (g (f))) (u => x) (u => u)
const sub = m => n => n (pred) (m)
// these functions are using js primitives so theyre not pure anyway
// which means i can use js features like binops and ternaries
const churchToJs = n => n (x => x + 1) (0)
const jsToChurch = n => n === 0 ? False : succ (jsToChurch (n - 1))
const True = x => y => x
const False = x => y => y
const If = cond => x => y => cond (x) (y) () // requires to be unwrapped b/c lazy
const isZero = n => n (_ => False) (True)
const gte = m => n => isZero (sub (n) (m))
const Y = f => (x => f (y => x (x) (y))) (x => f (y => x (x) (y)))
const div = m => n => Y (f => m => If (gte (m) (n)) (() => succ (f (sub (m) (n)))) (() => False)) (m)
console.log (churchToJs (div (jsToChurch (10)) (jsToChurch (2)))) // 5
Why not make a single method where you can specify what u want
Instead of having the same functionality on two different static objects
is it just me or are rust imports even easier to end up with an inconsistent mess than c includes
me when i include <windows.h> but it defines MIN
so std::min errors
const pair = a => b => f => f (a) (b)
const head = p => p (a => b => a)
const tail = p => p (a => b => b)
const range = low => high =>
low > high ? null :
pair (low) (range (low + 1) (high))
const map = f => xs =>
xs === null ? null :
pair (f (head (xs))) (map (f) (tail (xs)))
const fizzBuzz = x =>
x % 15 === 0 ? "FizzBuzz" :
x % 3 === 0 ? "Fizz" :
x % 5 === 0 ? "Buzz" :
x
// To make it printable in the console
const listToArray = xs =>
xs === null ? [] :
[head (xs), ...listToArray (tail (xs))]
console.log(listToArray (map (fizzBuzz) (range (1) (20))))
index.js?
Is this haskell
no its js
how about this one
type Succ<T extends number, acc extends number[] = []> = acc['length'] extends T
? [...acc, 0]['length']
: Succ<T, [...acc, 0]>;
type Add<T extends number, U extends number, acc extends number[] = []> = acc['length'] extends U
? T
: Add<Succ<T>, U, [...acc, 0]>;
type Mul<T extends number, U extends number, Res extends number = 0, acc extends number[] = []> = acc['length'] extends U
? Res
: Mul<T, U, Add<Res, T>, [...acc, 0]>;
type Prec<T extends number, acc extends number[] = []> = [...acc, 0]['length'] extends T
? acc['length']
: Prec<T, [...acc, 0]>;
type Sub<T extends number, U extends number, acc extends number[] = []> = acc['length'] extends U
? T
: Sub<Prec<T>, U, [...acc, 0]>;
type LessThan<A extends number, B extends number, acc extends number[] = []> =
acc['length'] extends A ? true :
acc['length'] extends B ? false :
LessThan<A, B, [...acc, 0]>;
type Div<A extends number, B extends number, acc extends number[] = []> = LessThan<A, B> extends true
? [...acc, 0]['length']
: Div<Sub<A, B>, B, [...acc, 0]>;
type Eval<T extends string> = T extends `${infer A extends number} ${infer Op extends string} ${infer B extends number}`
?
Op extends '+' ? Add<A, B> :
Op extends '-' ? Sub<A, B> :
Op extends '*' ? Mul<A, B> :
Op extends '/' ? Div<A, B> :
never
: never;
type Res = Eval<'15 / 3'>; // type Res = 5
insaneee
unhusk its beautiful
ok
thank you
i meant i wish i could have more encapsulation idk i'm not a js module wizard.. i just use esm and i don't think you can share things in the same folder without exporting it to everything in the same package
"i wish i could have more encapsulation" - statements dreamed up by devs who are NEVER productive
Too verbose, imagine repeating code for similar operations when you could have Op<~, ~> as a higher kinded type that accepts two type parameters
wdym though
i learnt with elle that the best way to write code and be productive is to make everything public and mutable and just not be stupid
it's nice not to export everything always, and you can only have things private to a file (at least with esm, to my knowledge)
(apart from with # fields but ew)
just mark them private in typescript
you can't have a # global
private public mutable? whats that girl
if someone (future you) fucks with them it's their problem
foo.___INTERNAL_DO_NOT_ACCESS___ = 3
i don't use classes much
i even tried to use old function style because in one case it did feel cleaner
but turns out ts suppotrs them really poorly
__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE
actually i think i'd prefer the old js style in most cases
(if anyone is unfamiliar)
insane

new new new new new new new new function() { return new.target }
new class extends class extends class extends class extends class extends function() { return new.target } {} {} {} {} {}
i wanna write this
function MyError(message) {
this.name = "MyError";
this.message = message;
}
MyError.prototype = Error.prototype;
am i strange
constructor() can also return any object including the class itself, which I realized is probably for compatibility with the old function style
yes
wait if you wanted to add moer properties would you do
Object.setPrototypeOf(MyError.prototype, Error.prototype);
or what
arrpc has some horrid code where it does constructor { return new Promise(resolve => {}) }
so you can do await new Class
😭
class {
static create(): Promise<> {
}
inb4 yield* await new Class()
INSAEN
think about it it's like go
rust also allows multiple impl blocks
also it's so weird that yield* is an expression while also yielding multiple values, which is why effect.ts can infer the return type
why don't modern js classes have this unless you monkey patch and well do part of it the old way
another mystery: why don't people use pimpl idiom in javascript
That's gotta get hard to find where everything is defined
What if some methods are only added conditonally or during the call of another method
I'm so glad es6 made classes at least somewhat normal
you can always monkeypatch
Monkeypatching shouldn't be the default way to do something!!
monkeypatching is a social construct
it's only monkeypatching if you do it dynamically or without consent
She monkey on my patch till I cannot read properties of undefined (reading "then")
because this is wrong
const x: BaseType = SubType;
Object.keys(x); // has way more keys than just the BaseType keys
Also it's kinda ironic that some things in js are specifically designed to not be monkey patchable like array or object constructors, or the await keyword behavior (except in nodejs)
wdym not be monkey patchable?
i already said second bestie
you can patch those things just fine
what if there was nts which is typescript without types
and you can kinda mess with the await behaviour
you just gotta define a then method on your object
types are just comments like erlang and python
jsdoc
i mean like built into syntax
truee
but you can write things inconsistently, it doesn't matter because they're just skipped
jsdoc insane
so you could do STRING or string or String
yeah i know this is just running a ts transpiler that doesn't check types shut up
some libraries have been moving back from ts to js and using jsdoc to type
I kinda get it cause making packages in typescript is annoying
just use deno 
actually nah
have to compile and it's kinda cbt
this language wouldn't have type aliases
takes like a main.ts and a jsr.json
you can write // @ts-nocheck even on ts files
and you can publish to jsr
or interfaces
I still haven't found a way to make typescript generate code that you can import from both esm and cjs
or node i think
cjs in 2025
index.ts: Lines 39-40
export default virtualMerge;
if (typeof module !== "undefined") module.exports = virtualMerge;
rename to verge
if you don't manually add the module.exports it fucks up and you can't require it anymore
what about it
its fine

I compile all my code to cjs
insanee

i use esm even with esbuild
it really isn't
esbuild ./test/index.js --outdir=dist/test --bundle --platform=node --format=esm --packages=external --sourcemap
I love having to type file extensions in the import
and when I'm using typescript I still have to type .js extension because typescript is retarded
don't you just use exports in package.json
sadan has lost it
didn't ts add an option to fix this?
idk man
in any case it doesn't affect everything
node's built in type stripping is fine with ts extensions
if you transpile export default to cjs with typescript, it outputs exports.default =
which means you can't just require it

