<d_bot>
<joris> (had lot of services serving thousands of requests per second with very large number of entries so lru was not working well unless the cache size was very big hence the generational setup, which performs much better when there is like 1% of request that frequently accessed and 99% that are cold
<Anarchos>
is establish_server a good server to use ?
<companion_cube>
redis has a least frequently used system, too
<d_bot>
<joris> Yeah I don't claim to have invented anything. To be honest there is probably a better algo that this, I just stacked two lrus it is not really lfu. But it performs very well in practice.
<mrvn>
joris: So anything that gets a hit in the first LRU gets moved to the second LRU?
<mrvn>
I once used a heap with <time since last access> * <num hits> as key. But then every update is O(log n).
<mfp>
I once bumped into this trick in some OCaml code (by Jean-Christophe Filliâtre maybe?): keep a counter per bucket; on hit, increment, on miss, decrement, replace if counter < 0 and reset to 1. A value will remain cached if it represents over 50% of the accesses to that bucket.
<Anarchos>
i would expect f to be applied to the default value for a and b, instead it evaluates to a partial function
<Armael>
I think you have to add a extra () argument to f (and provide it in g) to get that kind of behavior: let f ?(a = 1) ~b () = 1;; let g () = f ~b ();;
mxns has quit [Ping timeout: 260 seconds]
<Anarchos>
Armael i guessed that, but isn't it contradictory to the manual ? if i do «f ~b» , 'a' should be instantiated to its default value
borne has quit [Ping timeout: 260 seconds]
<Armael>
well optional/labelled arguments can be reordered
<Armael>
I think the fact that you get a partial application comes from that
mxns has joined #ocaml
aaaaaa has joined #ocaml
<d_bot>
<Lupus> @hannes @joris thanks for pointers regarding LRU, will look into both!
mxns has quit [Ping timeout: 268 seconds]
aaaaaa has left #ocaml [#ocaml]
mxns has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
<d_bot>
<joris> @mfp right indeed. I guess I should read the papers and make it better someday
tryte has quit [Ping timeout: 240 seconds]
<d_bot>
<joris> Right. I first tried to use a heap but the gc pressure was too hight for the usecase but I guess technically a heap is better
<d_bot>
<joris> @mfp nice trick!
<d_bot>
<joris> Oh i guess I should not use threads as it is messy on irc
mxns has quit [Ping timeout: 260 seconds]
tryte has joined #ocaml
bartholin has quit [Ping timeout: 268 seconds]
<mrvn>
Anarchos: If "f ~b" would apply "a" as well then you couldn't write "f ~b=1 ~a=5"
<mrvn>
It's a quirk in ocaml that optional arguments always need a unlabeled one so the compiler sees that th application is final and inserts all the missing optional ones.
mxns has joined #ocaml
mxns has quit [Ping timeout: 268 seconds]
hnOsmium0001 has joined #ocaml
mxns has joined #ocaml
bartholin has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 272 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 268 seconds]
gareppa has joined #ocaml
gareppa has quit [Remote host closed the connection]
mxns has joined #ocaml
drewolson4 has joined #ocaml
drewolson has quit [Ping timeout: 240 seconds]
drewolson4 is now known as drewolson
mxns has quit [Ping timeout: 264 seconds]
mxns has joined #ocaml
<d_bot>
<inkbottle> I've posted that in #beginners. I still have no clues on how to do it, or something along the same line.
<d_bot>
<inkbottle> ```ocaml
<d_bot>
<inkbottle> type hello = Lwt_unix.file_descr [@@deriving sexp];;```
<d_bot>
<mnxn> there is no way to print it like that without knowing how it's implementation
<d_bot>
<mnxn> You should write your own function that uses `Lwt_unix.state`, `Lwt_unix.unix_file_descr` and the functions in the `Unix` modules to get all the data you need to print it
mxns has joined #ocaml
<d_bot>
<beheddard> You can make it treat the type as opaque or ignore it.
<d_bot>
<beheddard> `(M.t[@sexp.opaque])`
mxns has quit [Ping timeout: 246 seconds]
<d_bot>
<inkbottle> Tx, first step in that direction did work.
mxns has joined #ocaml
dhil has quit [Ping timeout: 240 seconds]
mxns has quit [Ping timeout: 268 seconds]
steenuil__ has joined #ocaml
amiloradovsky has joined #ocaml
mxns has joined #ocaml
steenuil_ has quit [Ping timeout: 246 seconds]
mxns has quit [Ping timeout: 268 seconds]
mxns has joined #ocaml
<d_bot>
<inkbottle> And I read the other way to do it, or not to do it, above. So I believe it's settled.
mxns has quit [Ping timeout: 272 seconds]
<d_bot>
<beheddard> For the deriving libraries like deriving_yojson etc, writing your own function that matches the name that it is looking for is always an option
bartholin has quit [Ping timeout: 265 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
neiluj has joined #ocaml
neiluj has joined #ocaml
<neiluj>
Hello!
<d_bot>
<inkbottle> If it is in the https://github.com/ocsigen/deriving family, as I understand it is, it is using camlp4, and I understand it is superseded by ppx.
<neiluj>
trying to execute some processes with Lwt_process.exec, combined with Lwt_main.run to execute them
<neiluj>
but for some reason it crashes, and i can't see the exception raised (even by setting Lwt.async_exception_hook)
<neiluj>
is it correct to use Lwt_main.run in this case?
<neiluj>
More generally it seems that Stdio.printf doesn't print anything
bartholin has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 256 seconds]
narimiran has quit [Quit: leaving]
bartholin has quit [Ping timeout: 272 seconds]
mxns has joined #ocaml
bartholin has joined #ocaml
Jeanne-Kamikaze has quit [Ping timeout: 272 seconds]
tane has joined #ocaml
<neiluj>
nevermind, i had some misconceptions with lwt
neiluj has quit [Quit: leaving]
Anarchos has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
bartholin has quit [Quit: Leaving]
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
Anarchos has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
Anarchos has joined #ocaml
<Anarchos>
how to #trace inner defined functions ?
<companion_cube>
extract them so they're not inner
<Anarchos>
companion_cube i wonder why there is not a #trace f.g notation as for modules
<Armael>
I'm surprised that #trace still exists in 2020
<Anarchos>
Armael it is useful for recursive functions to see which step receives wrong arguments
<zozozo>
I always go for some printing/logging at the begining of the function for that instead of #trace, :p
<Anarchos>
zozozo which implies writing code to be deleted , and a compilation
<zozozo>
yeah, though to be more accurate, I rarely need to do that, and instead, it's more algorithmic problems I need to debug, and for that, adding good logging that stays in the code is a good idea anyway
<Anarchos>
zozozo sure. i use it to debug simple problems, not algorithmic ones
<zozozo>
well, it works on toy examples, but eventually, you need to debug codes that is quite far/deep inside of a code base, and then...
wonko7 has quit [Ping timeout: 260 seconds]
jnavila has quit [Ping timeout: 260 seconds]
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
urek has joined #ocaml
noonien has quit [Quit: Ping timeout (120 seconds)]
noonien has joined #ocaml
artymort has quit [Ping timeout: 240 seconds]
artymort has joined #ocaml
minimario has joined #ocaml
guanohhh has quit [Quit: Connection closed for inactivity]
<minimario>
hi! how can I load a file with all its dependencies into utop?
<minimario>
i tried #mod_use "blah.ml" but it didn't work
<minimario>
not sure what's the proper way to do this