Better HN
topnewbestaskshowjobs
Log inSign up

ngnk

28 karma · joined Jan 10, 2020 (6y ago) · 14 submissions

Submissions

comment 6y ago · link · parent

https://i.imgur.com/sJJWBtq.png

comment 6y ago · link · parent

ktye says it compiles with msys2/mingw (msys2.org). i haven't tried it as i don't use windows at all.

comment 6y ago · link · parent

regarding windows - see https://news.ycombinator.com/item?id=22010059

comment 6y ago · link · parent

ianal. to the best of my knowledge the project is clean from a legal perspective. ofc, you don't have to be doing something wrong to become a target of copyright trolling.

comment 6y ago · link · parent

1:x uses mmap, so it would return instantly no matter how large a file you give it

0:x uses 1:x and then it splits the content into lines. unfortunately splitting requires copying, so you'd be limited by the amount of ram (let's ignore "swap").

i don't use mmap for writing/amendment yet. i'll be working on it.

the way modern hardware works is like this: every process run by the os has its own view of the (typically 48-bit) address space. a process can request from the os that a part of that address space be "backed" by a certain file. this means that every time the process touches (i.e. tries to read or write) a virgin memory page there (usually page=4k, always aligned), the os will be automatically notified and will make sure to fill it in with actual content from the file, before the process even knows. from that point on, the page will occupy physical ram. if the os is low on memory later, it may decide to free up the page and return it to its previous state.

in effect, data from disk (or any disk-like storage) can be "streamed" while your program uses ordinary array indexing. the word "streaming" though implies reading from start to end in order (which is additionally sped up by prefetch, but that's a different story..); memory mapping is more general - it allows random access.

comment 6y ago · link · parent

reading is done with mmap. it returns instantly and then loads memory pages from disk only when you use them.

comment 6y ago · link · parent

    0:"path"                  /read  lines
    "path"0:("line1";"line2") /write lines
    1:"path"                  /read  bytes
    "path"1:"content"         /write bytes

comment 6y ago · link · parent

i can confirm, geocar's understanding of the code is correct

comment 6y ago · link · parent

the agpl is not so much about making concise code pleasant for the masses, as it is about making its freedom viral

comment 6y ago · link · parent

that's a good read, thanks. afaik zeroing %rbp here plays no role other than to assist debuggers. i'm not sure if alignment makes any measurable difference. if it does, it'll be worth doing. i jmp to main() because i wrote it and i know it never returns. it exit()-s.

comment 6y ago · link · parent

i'd encourage people to compile from source. the binary in "downloads" was compiled without the "-march=native" flag, in order to support older cpus, so it's a bit slower. also, i don't intend to update it regularly - i'll probably remove it in a couple of days.

comment 6y ago · link · parent

i changed it to "telemetry". i'm not really sure what to call it. they are upfront about it in the clickwrap eula but the data is not anonymized (see section 1.5a - in k ".z.u" means username) and you are not allowed to obstruct connectivity. it's not quite spyware either, as it happens with your consent.

comment 6y ago · link · parent

across architectures: you're right, as of now it's x86_64 only

across operating systems: it works on linux and freebsd as-is (thanks bakul), and with a few changes on windows+libc (thanks ktye) - https://github.com/ktye/i/tree/master/_/ngn though i personally never use windows

comment 6y ago · link · parent

any ideas for a more compact and efficient way to get argc and argv on both linux and freebsd without bringing in libc?