🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel! Set by lizmat on 6 September 2022. |
|||
roguerakudev | is there any way to look up an enum value based on its ordinal? Everything I've tried just gets the key as a string, but I want an instance of the enum type | 00:28 | |
the only thing I've found that works is calling pick with the total number of values, but that's really asinine | 00:33 | ||
leont | m: say Order.^enum_from_value(1) | 00:42 | |
camelia | More | ||
01:04
MasterDuke joined
|
|||
Voldenet | there's even easier way | 01:24 | |
m: say Order(1) | |||
camelia | More | ||
Voldenet | but it's slightly different, because it uses a coercer that internally uses enum_from_value | 01:28 | |
01:32
jpn joined
|
|||
Voldenet | related code github.com/rakudo/rakudo/blob/3c9f...akumod#L40 | 01:34 | |
01:37
jpn left
02:13
bent_fingers left
02:27
jpn joined
02:32
jpn left
02:39
kylese left,
kylese joined
03:15
kylese left,
kylese joined
03:23
jpn joined
03:29
jpn left
03:47
jpn joined
03:53
jpn left
03:57
bent_fingers joined
04:20
jpn joined
04:25
jpn left
05:17
jpn joined
05:22
jpn left
06:24
bent_fingers left
06:43
jpn joined
06:48
jpn left
06:50
jpn joined
06:55
jpn left
07:24
CIAvash joined
07:34
merp joined,
merp_ joined
07:39
jpn joined
07:43
sena_kun joined
07:44
jpn left
07:46
abraxxa-home joined
08:06
abraxxa-home left
08:16
abraxxa joined
08:34
jpn joined
08:39
jpn left
08:42
Sgeo left
09:29
jpn joined
10:35
dpk left,
dpk joined
11:07
CIAvash left
11:23
jpn left
11:32
jpn joined
12:08
Xliff joined
|
|||
Xliff | #raku | 12:08 | |
\o | |||
Meh. | |||
Does anyone live in Dayon, OH? | |||
I'd like to be there for the Total Eclipse | 12:09 | ||
12:31
jpn left
12:33
jpn joined
12:38
jpn left
13:02
jpn joined
13:17
jpn left
13:58
jpn joined
14:03
jpn left
14:07
jpn joined
|
|||
antononcube | Well, I live close Daytona, FL, but that is not close (geographically.) | 14:18 | |
14:24
merp_ left
|
|||
tbrowder__ | Voldenet: my Date::Event class has what i think is an easy and practical way to handle enums | 15:11 | |
patrickb | I'm searching for some reference of how long typical tasks in software take / how costly they are (I know that I'm pretty bad at estimating this). I.e. a branch, a call, a network request, a lock, a sys call, different memory accesses, ... Any recommendations of where to look? | 15:17 | |
japhb | patrickb: Do you mean at the hardware level or in a high level language? | 15:44 | |
patrickb | both. I guess it's important to develop a feel for how expensive things are to make the right tradeoffs. Current case I'm pondering: Is using a mutex in the IO::Socket::SSL hot path (a `protect` on every packet received) a show stopper or are the lock costs in a different ballpark than stuff arriving over network? | 15:48 | |
japhb | Oh, I definitely think that's a good idea. | 15:49 | |
Xliff | patrickb; Good questions! I could use something like that too. | ||
japhb | At the hardware level, since processors have been doing branch prediction for decades now, it's primarily *mispredicted* branches and calls that have a cost, because they flush the pipelines and may require loading uncached code. Correctly predicted branches have only normal instruction costs. | 15:51 | |
15:53
Xliff left
|
|||
japhb | Memory levels tend to be somewhere around: Registers: "instant", L1 cache: 2-3 cycles, additional cache levels approximately double the previous level, main mem on same NUMA node: ~100 cycles, additional time + possibly bus/switch contention going to another NUMA node. | 15:54 | |
Network access is .1-1 ms for loopback, but considerably slower for anything further. Speed of light is ~30 cm/nanosecond (or around 1 foot / nanonsecond, jokingly called a "phoot": 'photon-foot'), and through fiber or copper signals travel at about 2/3 that speed. That's your limit for performance, but a lot of time gets lost in buffering, wire speed queuing, imperfect cable routing, etc. Assume 10-100 ms | 15:57 | ||
for most people pinging through a wired network, considerably more for cellular and other wireless networks. | |||
Locks and syscalls are *very* dependent on OS and whether the locks are user-space or kernel-space or some hybrid. | 15:58 | ||
For locks, the biggest slowdown is contention. The less contention on a lock, the faster it goes. Highly contended locks soak your code in molasses. Lock contention grows with both number of threads working in the same code and the length of time the "inside" of the lock protection takes. Reducing either of those helps a lot. | 16:00 | ||
Syscall time is dependent on processor type and generation, as well as how many "rings" (layers of CPU security) you go through. For example, user space to hypervisor takes longer than user space to current OS. Some processors have special functionality to speed up VM syscalls because that's what primarily runs on them (Xeons are the Intel version, for instance). | 16:02 | ||
Uncontended locks and "fast" syscalls are a few 10s to 100s of clock cycles. | 16:03 | ||
Again, this is all at the lowest levels. But does that give you useful starting info? | 16:04 | ||
patrickb | That's a very good start, thanks! In the current case, going with 300 cycles for a rather uncontended lock and having a 2GHZ CPU that makes 0.00015 ms for lock access. Compared to .1-1ms for loopback, yeah, that's a different ballpark. This is exactly the kind of reference I was looking for. \o/ | 16:13 | |
16:33
jgaz joined,
Guest98 joined
16:36
Guest98 left
18:04
perlbot_ joined
18:11
dpk left,
abraxxa left,
kylese left,
human-blip left,
lizmat left,
kaskal- left,
perlbot left,
mark22k left,
heartburn left,
leedo left,
amenonsen left,
synthmeat left,
Aedil left,
perlbot_ is now known as perlbot,
lizmat joined
18:12
irth left
18:13
irth joined
18:15
leedo joined
18:17
dpk joined,
mark22k joined,
kylese joined
18:18
kaskal joined
18:19
abraxxa joined,
leah2 left,
synthmeat joined,
human-blip joined,
amenonsen joined
19:00
leah2 joined
19:12
vlad joined
|
|||
lizmat | and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2024/02/26/2024-...s-zombies/ | 19:12 | |
19:13
vlad left,
vlad joined
19:17
jpn left
19:21
jpn joined
|
|||
antononcube | 🌻 🫛 | 19:27 | |
lizmat | :-) | 19:28 | |
19:28
MasterDuke left,
jpn left
20:00
abraxxa left
20:15
jpn joined
20:18
vlad left
|
|||
Voldenet | tbrowder__: there's no need to do `%m = EType.enums` and then `%m{$v}`, `EType::{$v}` could be used | 20:41 | |
somewhat confusing example: | |||
m: enum N (11..31); my IntStr $n = <12>; N::{$n}.say; N($n).say | |||
camelia | 12 23 |
||
20:51
xinming left
20:53
xinming joined
20:56
jpn left
21:35
sena_kun left,
sena_kun joined
21:41
jpn joined
21:44
MasterDuke joined
|
|||
gfldex | m: enum Foo (1..42); say Foo::<42>.WHO.WHAT; | 22:13 | |
camelia | (Stash) | ||
22:36
jpn left
22:47
jgaz left
22:52
Riviera joined
23:05
sena_kun left
23:45
bent_fingers joined
23:59
Xliff joined
|
|||
Xliff | \o | 23:59 |