mcountryman
mcountryman on Hacker News
I had to picture someone opening a window and throwing it into orbit haha
Not a financial expert however, Citadel is a market maker rather than just a hedge fund like Melvin.
Money is lost when a retail investor holds onto their shares not just when the stock price rises.
I'm a little short on time so I didn't read through all of it but, comptime generics sounds similar to how rust compiles generics and comptime parameters are similar to const fns although zig appears to have more control over what is deamed "compile time".
Very well optimized inlined functions?
I didn't actually check the zig std source. I was referring to what I was seeing in radare2 :)
Yeah my choice of words wasn't great. It seams as if the zig std acts as a macro rather than a wrapper. That could just be the aggressive optimization though
@Edit2 I saw that, and that's pretty cool in regards to how the zig std is a wrapper rather than a rewrite. Although, if we were optimizing for size in this case it might be more optimal to have only one entry in the import table :D
Between a 40b strcmp method (If I had/if it was more widely supported I could use sse4.2 strcmp) and ~74b of resolving said exports a couple syscalls sounds pretty nice provided the context switch isn't more expensive than resolving the imports.
I thought of that but couldn't figure out how to get the syscalls for my system and the assembly around it. Being on win10, kernel32 links to api-console-... and I haven't been able to find it on my system. A few online downloads had it but, they don't export `GetStdHandle` and `WriteFile`. I thought maybe there was dynamic export generation going on because they did have those names as strings.
Edit: Also I believe ntdll doesn't export `GetStdHandle` anymore.
In order to get that to 1Kb you would probably have to drop the `.idata` section and resolve syscalls from the PEB like I did.
Ah, yeah, I wasn't trying to shrug off the usefulness of zig, sorry. I think when it comes to compile size zig does it a bit better due to it's smaller std although, when compiling rust with just a link to libc and a printf call I believe you get an exe ~2048b when optimizing for size so I'm not certain how well that scales.
The 100 line hack I used was to noop out the `.idata` section which link.exe refused to merge/shrink, that only saved me 1Kb in the end.
Looking at the section info of the zig exe it looks like there is some black magic going on with it's alignment so I may have to dig deeper to see what zig is doing here. Also thank you both for pointing zig out, I haven't heard of it until now and it may come in handy for something else I'm planning on making :)
Just for fun, the compiled rust exe has 480 non-zero bytes, the zig exe had 512 bytes.
I couldn't get it working and was familiar with the `llvm_asm!` syntax. Although, I may have to go back and switch it around again.
I linked these guys here
https://github.com/pts/pts-tinype. They managed to do something similar with the PE headers, and I might have to try that next although I'm doubtful win64 exes are permitted to run if they are >1Kb
This is my attempt at making the smallest exe with rust for windows using the msvc toolchain. If y'all have any pointers how to get it smaller let me know :)
Posted by
mcountryman on Monday November 30, 2020 @03:21PM
from the show-hn dept.
From 200+ comments "cancel" was listed 4 times in that reddit thread and "return" was listed 5 times. Some repeats in there.