<Enjolras>
not the super ugly Gc.full_major, as i've not found any way to call msync(2) except getting the finalizer to run
Jesin has quit [Max SendQ exceeded]
Jesin has joined #ocaml
<xvilka>
Enjolras: ok, thx. But what is the right way?
<xvilka>
If I have 4Gb Bigarray and want write it to a file
Jesin has quit [Max SendQ exceeded]
<Enjolras>
There does not seem to be a right way to call msync in ocaml
Jesin has joined #ocaml
<Enjolras>
xvilka: you can iterate in chunks of say 32KB and just use write
<Enjolras>
the actual optimal block size depends a lot on the FS and underlying disk
<Enjolras>
mmap is mostly useful for reading
<xvilka>
Enjolras: it will be very slow to be honest. What I do - I have a large file, packed with custom compression format by chunks, so I mmap it for reading yes. But I cannot unpack it whole in the memory, so I have to write uncompressed chunks to the file. This is why I thought mmap-ing file for writing is a way to go
neatonk has quit [Ping timeout: 276 seconds]
<Enjolras>
i'm not sure i understand
<xvilka>
Enjolras: I don't write Bigarray all at once, I write it by chunks, this is why I used blit
<Enjolras>
but why can't you use Unix.write ? i don't get it
<Enjolras>
the only overhead of write compared to mmap is a memcopy
<xvilka>
Unix.write requires buffer instead of Bigarray, conversion to it afaik is consuming too much resources
<Enjolras>
oh i think i get it, you mean blitting from bigarray to string is slow ?
<Enjolras>
hm
<xvilka>
yes
<Enjolras>
i see this is unfortunate, for char bigarray to bytes, the layout is the same and it should just be a memcopy
<Enjolras>
but i don't know if/where this function would be exposed
<xvilka>
Enjolras: I am even thinking to write a C stub by myself, but still hoped there is a better solution
jeroud has quit [Ping timeout: 276 seconds]
mattg has quit [Ping timeout: 276 seconds]
banjiewen has quit [Ping timeout: 276 seconds]
chenglou has quit [Ping timeout: 276 seconds]
bjs has quit [Ping timeout: 276 seconds]
mattg has joined #ocaml
fredcy- has joined #ocaml
<Enjolras>
xvilka: what do you use ? do you use bigstringaf ?
chenglou has joined #ocaml
banjiewen has joined #ocaml
sspi___ has joined #ocaml
<Enjolras>
i see there is a blit_to_bytes there
Geekingfrog has quit [Ping timeout: 276 seconds]
<Enjolras>
val blit_to_bytes : t -> src_off:int -> Bytes.t -> dst_off:int -> len:int -> unit
<Enjolras>
that's a lib with a lot of helpers to work with bigarrays of dimension one of chars
<Enjolras>
might help you for other stuffs too since it's what to seems to be doing
<Enjolras>
blit_to_bytes is just a call to memcpy, should be fast
shinnya has joined #ocaml
<xvilka>
cool
<xvilka>
thank you again
hdon has joined #ocaml
hdon has quit [Ping timeout: 240 seconds]
leah2 has joined #ocaml
wickedshell has joined #ocaml
mcspud has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jao has quit [Ping timeout: 256 seconds]
moei has joined #ocaml
sagotch has joined #ocaml
kakadu has joined #ocaml
mikeyhc has joined #ocaml
mbuf has quit [Ping timeout: 260 seconds]
hdon has joined #ocaml
hdon has quit [Ping timeout: 240 seconds]
argent_smith has joined #ocaml
freyr69 has joined #ocaml
mbuf has joined #ocaml
kvda has joined #ocaml
dhil has joined #ocaml
mikeyhc has quit [Ping timeout: 240 seconds]
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ZirconiumX>
I think writing this assembler is helping me understand why AT&T syntax is a thing.
<ZirconiumX>
I might switch to it, honestly. It'd make my life much easier.
<bartholin>
AT&T syntax has been invented after a prayer to Cthulhu went wrong.
ziyourenxiang has joined #ocaml
<ZirconiumX>
bartholin: perhaps it's heavy on the sigil spam, but it solves a lot of my problems
jaar has joined #ocaml
<ZirconiumX>
For example, somebody makes a variable called eax. Bad idea, but they did all the same
<ZirconiumX>
Should an assembly instruction that mentions eax use the variable or the register?
<ZirconiumX>
In AT&T syntax, there's no such ambiguity
<ZirconiumX>
Because it's always referenced as %eax
zolk3ri has joined #ocaml
jaar has quit [Quit: Leaving]
dhil has quit [Ping timeout: 240 seconds]
Jesin has quit [Ping timeout: 260 seconds]
Jesin has joined #ocaml
zolk3ri has quit [Quit: leaving]
zolk3ri has joined #ocaml
Haudegen has joined #ocaml
pistachio has quit [Ping timeout: 240 seconds]
pistachio has joined #ocaml
mfp has joined #ocaml
hdon has joined #ocaml
hdon has quit [Ping timeout: 240 seconds]
kakadu has quit [Quit: Konversation terminated!]
kakadu has joined #ocaml
kakadu has quit [Remote host closed the connection]
shinnya has quit [Ping timeout: 276 seconds]
sagotch has quit [Quit: WeeChat 1.9.1]
<xvilka>
ZirconiumX: what if someone makes a variable called %eax with AT&T syntax?
sagotch has joined #ocaml
<ZirconiumX>
Pretty sure that's not valid OCaml
sagotch has quit [Ping timeout: 276 seconds]
jao has joined #ocaml
<xvilka>
ZirconiumX: since you are working on the assembly, you might want to check also BAP - github.com/BinaryAnalysisPlatform/bap
<ZirconiumX>
xvilka: I'm writing a JIT, so I'm planning something like DynASM for OCaml, using PPX nodes
BitPuffin has joined #ocaml
shinnya has joined #ocaml
hdon has joined #ocaml
<xvilka>
ZirconiumX: ah, ok
hdon has quit [Ping timeout: 244 seconds]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
sagotch has joined #ocaml
<dmbaturin>
xvilka: That's the motivation behind % prefix, it's not valid anything but AT&T assembly, other than in some very exotic languages perhaps.
Jesin has quit [Ping timeout: 240 seconds]
Haudegen has quit [Remote host closed the connection]
moei has quit [Ping timeout: 276 seconds]
hdon has joined #ocaml
<bartholin>
what if you just don't call any variable eax. Problem solved.
<ZirconiumX>
Of course, but that just results in awkwardness
jbrown has joined #ocaml
<ZirconiumX>
Like, my plan is something like %#foo and $#foo to mean "interpret foo as a register" and "interpret foo as an immediate" respectively
hdon has quit [Ping timeout: 276 seconds]
jaar has joined #ocaml
jaar has quit [Client Quit]
rjbou has joined #ocaml
spew has joined #ocaml
neatonk has joined #ocaml
shinnya has quit [Ping timeout: 264 seconds]
mbuf has quit [Quit: Leaving]
neatonk has quit [Ping timeout: 260 seconds]
neatonk has joined #ocaml
al-damiri has joined #ocaml
TheLemonMan has joined #ocaml
Jesin has joined #ocaml
kakadu has joined #ocaml
Guest60195 has joined #ocaml
Guest60195 has quit [Read error: Connection reset by peer]