Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
AlgoRythm5092361dThat being said: I'm on my way to creating something that lets me resolve URLs (for web server routing) completely on the stack!
-
AlgoRythm5092360d@jestdotty Honestly I am very glad I skipped rust. My least favorite part of c++ by FAR was template classes and when I think of Rust, I just think of being unable to avoid crazy template-like syntax as part of my everyday usage whereas even in c++ I only had like 2 legitimate reasons to make a template.
Zig has a certain beauty about it. They treat classes like first-class citizens. As long as your task can be done at comptime, they allow a squish and soft interpretation of the type system and it's a little wonky at first, but absolutely freeing once you get the hang of it. -
AlgoRythm5092360d@azuredivay it doesn’t transpile to c. They’re actually, I believe, even looking into ditching LLVM and making something in-house to get even better results.
-
Lensflare1718360d@AlgoRythm Swift is also a great language which lets you compute and synthesize things at compile time.
When the zig-fan youtuber ThePrimeTime first tried Swift, he instantly fell in love with it 😂 -
retoor1213260dI love this kind of posts. Pure dev and educational. Learned smth.
It's like the old JS indeed. In that time - i was going hardcore on ExtJS (People wouldn't learn this because of steep learning curve. Those people should see React now. ExtJS was way ahead of it's time). ExtJS wasn't free, but to be fair, there was no framework comparable to this. Don't 'mootools' me or even worse - 'jquery ui' me. Wrote huge frontend application in it. So heavy, chrome was in that time way faster than IE so every company computer upgraded to chrome.
I think this complete OO stuff worked pure by coincidence btw :P
@Lensflare Swift sounds like a nice looking but slow car my mom would buy. She did -
Lensflare1718360d@retoor in case you wanted to imply that Swift is slow, it isn’t. 🙂
Swift is the awesome looking and lightning fast car. Also quite beginner friendly. More so than C# or Rust for example. -
retoor1213260d@Lensflare I try not to steal idea's from other regex interpreters but I did read the C# source code from the .Net RegexInterpreter today and I was really like "Hmm, what is C# actually a nice language". I compiled my C interpreter to a so lib and benchmark it against C#. Mine is a LITTLE bit faster. Don't know if external lib slows down a bit. I was amazed that such fast interpreter was written in C#, it doesn't use the C implementation as backend.
Ok, back to the Swift. Dude, it's really slow. But besides that, it doesn't feel by far as decent like a VW Polo which is in the same class for example while just being a few thousand cheaper. A swift is 21.000 or smth.
The Sport Swift is just darn beautiful.
Interesting how the VW UP!, Aygo and Mii disappeared while they were so popular huh? They didn't make enough monneeh on dem. Now we're back to cars worth 21.000. Bastards -
AlgoRythm5092360d@retoor the fastest regex engine I have ever used was in Node.JS
There must be years of intense optimization there. Interested in adding that to the benchmark mix. -
AlgoRythm5092360d@Lensflare I’m glad prime promotes Zig so much. Not only does it get me hype, but it adds recognition to the language.
I found it originally from davepl’s prime number sieve benchmark between every programming language. Zig came ahead of even ASM. -
retoor1213260d@AlgoRythm my regex beats the original C one AFTER compilation. The C has a slow compiler but executes batshit fast. All my focus was on beating that one. I did. Challenge accepted! Will try the node one. I wonder if i can load an so in node. I'll be back with updates about this where nobody asked for
-
retoor1213260d@AlgoRythm tsoding got even paid to promote the language. IIRC he liked it more than Rust since the good language binding with C
-
AlgoRythm5092360d@retoor I’m not sure about c binary compatibility with node without some sort of binding layer. Never tried.
I believe that the node regex engine is googles RE2 engine based off the knowledge that Google maintains v8. I know the default c++ and even the boost c++ regex engines both are awful. Never tried c regex though. -
AlgoRythm5092360d@retoor yeah zig and c are best friends whereas rust and c are like mutuals. Not a great look for a machine language IMO
-
retoor1213260d@AlgoRythm I won't try the boost one. I'm one hundred percent sure I beat that one. Boost is so sickly bloated. I do know that just recently it was updated not to hang in infinite loop anymore. But mine can do that too with some faulty expression I guess.
It was hard to find a balance between code quality and performance to beat the C interpreter. I couldn't believe how fast it was compared to mine at the beginning but then - i found out it uses the libc dynamic library which was compiled with optimizations and my application wasn't. The C interpreter get's faster every time you execute it. A few times it optimizes or something during parse time. Not only compile time. Writing a FULL featured regex is quite an art. Most fun thing I ever coded tho -
AlgoRythm5092360d@retoor after I finished my HTML parser, I started on a query interpreter a la document.querySelector[All]. At that point I got bored of c++ and state machines.
-
retoor1213260d@AlgoRythm you used a state machine for that? I wrote one too in C. I was very annoyed by the non-closing tags. The code was so nice but then had to rape it with that exception. Did you write your own lexer? Did you support only valid html or also dirty ones? Using single quote / no quotes at all for attributes? Mine did only perfect HTML IIRC, double quotes and stuff. It also supported kinda XPath IIRC. I do remember that it was a lot of fun
-
AlgoRythm5092360d@retoor I used a state machine for both the lexer and parser. It handled self closing tags and was lenient with dirty HTML such as automatically filling in missing end tags. It’s a great project honestly! Too bad I hate c++
-
retoor1213260d@Algorythm I tried to install ffi-napi which is the binding of choice between an so-lib and node. After trying: node 22, 18, 12 and 8, compiling ffi-napi from source and then finding a `-1`-ed closed question from 12 days ago on SO I decided that i had enough. This is a clean install ffs and all compilation tools are available fffs. For now, I lost interest, I kinda expected it to have it working in a hour since I already have a working so-lib. In dotnet I had it working in a hour including installation. Also, that installation didn't work out of the box. Couldn't find sdk's without some kungfu. Installation of node with nvm was more comfortable tough
-
retoor1213260d@Algorythm I never miss smth from C++ when writing C. I do like some typing. My keyboard goes like an AK47. Rakketakketak. Only namespaces are really missing in C
-
AlgoRythm5092360d@retoor the global namespace in c is ten thousand miles long. Zig solved this oh so nicely with its import system.
Though I will admit I am a OOP lover. Inheritance is highly overused but it’s beautiful when used correctly. The rest of OOP kinda sucks though. -
Lensflare1718360d@retoor why do you keep saying that Swift is slow? 🥺
It’s faster than C# because it’s compiled to machine code, not to byte code which is then interpreted. It doesn’t have GC to slow it down and has a lot of value semantic primitives which avoids slow heap allocation. It doesn’t have a notoriously expensive and slow exception mechanism like C# does, because again, value semantics and GC.
It relies on the type system to encode many things right into it at compile time rather than relying on dynamic resolution at compile time which slows C# down.
And it has a macro system which allows code execution at compile time.
It’s a perfect blend of convenient and elegant syntax and high speed that you would only expect from a low level language like C. -
retoor1213260d@Lensflare I'm only talking about the car and I only said that Swift sounds like a slow car. I didn't make any comment about the programming language :P But thanks for this great review. I seriously appreciate. Doesn't take away that Swift also sounds like smth you could clean floors with using soft tissues tho
-
retoor1213256d@lensflare / @algorythm deno is awesome! Fixed it in no time to load c extension in TS:
```
const lib = Deno.dlopen(
"./librmatch.so",
{
match: { parameters: ["pointer", "pointer"], result: "i32" },
}
);
```
Now i can just do:
```
const res = lib.symbols.match(arg1,arg2);
```
But you have to run deno with --unstable-ffi flag.
Deno is cool in general, live TS compiling, compiling to binary, build in ffi...And the installation is a one liner
Related Rants
I gotta say. Zig generics / comptime code gen remind me of old (pre-prototype) JavaScript code where you construct an object using parameters and return that object to be used as a class (except in this case it's actually turned into a class at comptime instead of an object masquerading as class)
rant
zig