companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.3.0 released: https://ocaml.org/releases/5.3.0 | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
Haudegen has quit [Quit: Bin weg.]
ocabot has quit [Server closed connection]
ocabot has joined #ocaml
discocaml has quit [Server closed connection]
discocaml has joined #ocaml
casastorta has quit [Ping timeout: 240 seconds]
<discocaml> <tym972_45887> Hello, I'm writing a chess program in OCaml. For now, I'm using integer arrays to represent the chessboard (mailbox). Do you think it's possible to replace these arrays with bitboards (sets of int64s) - possible in the sense that speed elo is gained? Or do you think it's a waste of time and that I should switch languages?
<discocaml> <yawaramin> why wouldn't it be possible? OCaml has int64 with logical operations, you can definitely implement a bitboard if you want
casastorta has joined #ocaml
<discocaml> <tym972_45887> The best other OCaml program I've found uses bitboards. Its move generation speed is truly disastrous compared to mine. I haven't really looked into it, but maybe he's done it wrong.
casastortaAway has quit [Ping timeout: 260 seconds]
<discocaml> <tym972_45887> The best other OCaml program I've found uses bitboards. Its move generation speed is truly disastrous compared to mine. I haven't really looked into it, but maybe he's done it wrong or I'm using his program incorrectly.
marijanp has left #ocaml [Error from remote client]
casastorta has quit [Quit: ZNC 1.10.1 - https://znc.in]
casastorta has joined #ocaml
casastortaAway has joined #ocaml
itszor has joined #ocaml
_jbrown_ has quit [Ping timeout: 252 seconds]
bibi_ has quit [Quit: Konversation terminated!]
oisota0 has joined #ocaml
ridcully_ has joined #ocaml
oisota has quit [Read error: Connection reset by peer]
oisota0 is now known as oisota
ridcully has quit [Ping timeout: 260 seconds]
bacam has quit [Server closed connection]
bacam has joined #ocaml
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 255 seconds]
myrkraverk has joined #ocaml
myrkraverk_ has quit [Ping timeout: 260 seconds]
<sleepydog> an `int64 array` has an extra layer of indirection compared to an `int array`, that could affect how well your program utilizes the cpu cache
<discocaml> <Kali> an int64 *big*array avoids this, i think
sadiq has quit [Server closed connection]
sadiq has joined #ocaml
<sleepydog> or even `bytes` with the get/set_int64_ne functions
casastorta has quit [Ping timeout: 260 seconds]
mange has joined #ocaml
casastorta has joined #ocaml
myrkraverk_ has joined #ocaml
YuGiOhJCJ has joined #ocaml
myrkraverk has quit [Ping timeout: 260 seconds]
euphores has joined #ocaml
Humean has quit [Ping timeout: 252 seconds]
casastorta has quit [Ping timeout: 255 seconds]
casastortaAway has quit [Quit: ZNC 1.10.1 - https://znc.in]
casastorta has joined #ocaml
marijanp has joined #ocaml
casastortaAway has joined #ocaml
Humean has joined #ocaml
myrkraverk has joined #ocaml
myrkraverk_ has quit [Ping timeout: 252 seconds]
<discocaml> <shadowkestrel> iirc this is how some part of Stdlib (i think CamlinternalFormatBasics?) handles char sets - since 256 is a relatively small number of bits, it uses a string (or bytes) as a bitset
marijanp has left #ocaml [Error from remote client]
marijanp has joined #ocaml
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 252 seconds]
Serpent7776 has joined #ocaml
bartholin has joined #ocaml
myrkraverk has joined #ocaml
myrkraverk_ has quit [Ping timeout: 255 seconds]
steenuil has quit [Server closed connection]
steenuil has joined #ocaml
toastal has left #ocaml [#ocaml]
toastal has joined #ocaml
toastal has left #ocaml [#ocaml]
toastal has joined #ocaml
marijanp has left #ocaml [Disconnected: Hibernating too long]
Haudegen has joined #ocaml
<discocaml> <mostafa_touny> I suggest to add we a **Design Patterns** entry on OCaml's doc. Emulating **Type-Classes** is a common problem, and multiple solutions are suggested including **Open Variants**, **Functors**, and **Runtime Dispatch**.
<discocaml> <mostafa_touny> Is anyone aware of any resource close to such design patterns for OCaml?
<discocaml> <mostafa_touny> Is anyone aware of any resource close to such design patterns for OCaml? If not, then I suggest we add an entry for them on OCaml's doc.
<discocaml> <mostafa_touny> Emulating **Type-Classes** is a common problem, and multiple solutions are suggested including **Open Variants**, **Functors**, and **Runtime Dispatch**.
Anarchos has joined #ocaml
<discocaml> <mostafa_touny> Emulating **Type-Classes** is a common problem, and multiple solutions are suggested including **GADTs**, **Open Variants**, **Functors**, and **Runtime Dispatch**.
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 260 seconds]
dhil has joined #ocaml
shwouchk has quit [Read error: Connection reset by peer]
shwouchk has joined #ocaml
hannes has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
semarie has quit [Quit: quit]
semarie has joined #ocaml
marijanp has joined #ocaml
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
semarie has quit [Quit: quit]
semarie has joined #ocaml
toastal has quit [Ping timeout: 260 seconds]
<discocaml> <shalokshalom> Maybe start, by evaluating what you think you need it for.
<discocaml> <shalokshalom> It's amazing, how people dribble around multiple dispatch.
Anarchos has joined #ocaml
toastal has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
Anarchos has joined #ocaml
marijanp has left #ocaml [#ocaml]
mange has quit [Remote host closed the connection]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
Haudegen has joined #ocaml
Haudegen has quit [Client Quit]
<discocaml> <yawaramin> sleepydog: a bitboard is a single int64, not an array
Haudegen has joined #ocaml
<discocaml> <bluddy5> Feel free to submit an article on ocamlverse.net
quernd1 has quit [Server closed connection]
<discocaml> <bluddy5> But it's still heap allocated. If the point is running as fast as possible, int64 will probably not get you there. He might want to try out #oxcaml .
quernd1 has joined #ocaml
<sleepydog> you need multiple bitboards to make up a chessboard, no? i must admit i know nothing about chess engines
<discocaml> <yawaramin> neither do i, i am going off Wikipedia 😁
marijanp has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
Anarchos has joined #ocaml
Serpent7776 has quit [Ping timeout: 252 seconds]
Haudegen has joined #ocaml
<discocaml> <froyo> intuitively a chess board has 64 cells, so assuming a bit indicates whether or not a piece is on a cell, you just can't represent the info of *which* piece is it without having multiple views of the same board per piece kind (so six bitboards)
marijanp has left #ocaml [Error from remote client]
<discocaml> <froyo> is a 32-char bytes small enough to encode a chessboard without relying on oxcaml? each char would represent a piece (3+3bits for coords, 1 bit for alive or not), and its index would represent its type (4 bits for kind, 1 bit for color).
<discocaml> <froyo> that's the smallest encoding I could come up with
<Anarchos> froyo yes it seems
<Anarchos> froyo you even have an extra-bit per char :)
<discocaml> <froyo> so it's valid ascii of course :P
theze_ has joined #ocaml
myrkraverk__ has joined #ocaml
marijanp has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
<discocaml> <bluddy5> from what I read, you also want to make sure you're activating the right bit-level x86 (or ARM) operations to make things efficient.
<discocaml> <bluddy5> I don't know if ocaml supports those.
myrkraverk_ has quit [Ping timeout: 252 seconds]
Humean has quit [Ping timeout: 252 seconds]
marijanp has left #ocaml [Error from remote client]
Anarchos has joined #ocaml
marijanp has joined #ocaml
<discocaml> <shadowkestrel> ive never seen ocamlopt output simd operations in godbolt, i have a feeling it just cant output them? but id need to look inside the compiler's source to say for sure, and that would be effort
ello has quit [Ping timeout: 244 seconds]
<discocaml> <froyo> but how often would you need to do an operation on the board in bulk? and wouldn't `int * int * int * int` or `bytes`suffice really? it's worth implementing and measuring before reaching for simd
<discocaml> <froyo> idk how engines work, but if it's turn by turn etc then at most you're working with one of those `int`s at a time
<discocaml> <yawaramin> yeah i guess the main question is what is the performance requirement
<discocaml> <yawaramin> like do they need to generate a move in a few microseconds or something
Serpent7776 has joined #ocaml
ello_ has joined #ocaml
bibi_ has joined #ocaml
theze_ is now known as Humean
<companion_cube> You probably want bytes instead of a tuple
marijanp has left #ocaml [#ocaml]
cr1901 has quit [Read error: Connection reset by peer]
cr1901_ has joined #ocaml
myrkraverk has joined #ocaml
myrkraverk__ has quit [Ping timeout: 248 seconds]
Serpent7776 has quit [Ping timeout: 260 seconds]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
philipwhite has quit [Server closed connection]
philipwhite has joined #ocaml
hsw has quit [Read error: Connection reset by peer]
hsw has joined #ocaml
johnridesabike has quit [Quit: johnridesabike]
dhil has quit [Ping timeout: 260 seconds]
euphores has quit [Ping timeout: 255 seconds]
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 255 seconds]
itszor has quit [Read error: Connection reset by peer]
itszor has joined #ocaml
bartholin has quit [Remote host closed the connection]
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Tuplanolla has joined #ocaml
Haudegen has joined #ocaml