Re: digraph edges and improper lists
Fred Youhanaie <[email protected]> Mon, 20 Dec 2021 19:52:46 +0000
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Mikael On 20/12/2021 18:19, Mikael Pettersson wrote: > On Mon, Dec 20, 2021 at 6:12 PM Fred Youhanaie <[email protected]> wrote: >> >> Hi Dmytro >> >> Many thanks for the explanation and the links. >> >> So, we save memory when using an improper list instead of proper list of 2 elements. >> >> How about 2-element tuples? It seems to be similar to the improper list, but I haven't read text properly yet! > > A 2-element tuple consumes 2+1 = 3 words, so it's not as compact as a > single list cell. It's also faster to determine the shape of that > single list cell than of the 2-element tuple (for the list cell we > only need to inspect the handle, while for the 2-element tuple we also > have to fetch its header and inspect that). Many thanks for the clarification. > As long as this is hidden behind appropriate ADTs no-one should care > what the representation is. For the digraph, I didn't care about the representation until logger crashed in me! Cheers, f.