<< 25-10-2026 >>

00:12:02*KawaiiSelbst quit (Remote host closed the connection)
00:12:19*KawaiiSelbst joined #nim
00:14:25*KawaiiSelbst quit (Remote host closed the connection)
00:14:42*KawaiiSelbst joined #nim
00:14:47*xtr00_ quit (Read error: Connection reset by peer)
00:19:57*iwuvmika joined #nim
00:57:35*joast joined #nim
01:34:34*insanescholar_ quit (Ping timeout: 260 seconds)
01:55:39FromDiscord<janakali> In reply to @b0rsuk "Does division really happen": it's not that it's rare, but it should be generally avoided in algorithms, because division is 10x slower than anything else.
03:38:28FromDiscord<egbert_37195> In reply to @b0rsuk "I think you're rewriting": Not a conversion, it was a fresh start with naylib, gradually enhancing bits, tho the initial concept was based on things I remember from doing game mods and maps long ago. 40+ years of programming behind me, still enjoy learning new tools and languages.
05:10:08*insanescholar_ joined #nim
05:12:32*insanescholar_ quit (Remote host closed the connection)
06:01:23*emery quit (Read error: Connection reset by peer)
06:02:05*emery joined #nim
06:34:34*iwuvmika quit (Ping timeout: 244 seconds)
06:34:48*iwuvmika joined #nim
08:23:52FromDiscord<tempestro> In reply to @janakali "it's not that it's": that's generally a microoptimization not worth thinking about imho
09:14:00*KawaiiSelbst quit (Remote host closed the connection)
09:14:47*KawaiiSelbst joined #nim
09:28:30*KawaiiSelbst quit (Remote host closed the connection)
09:28:47*KawaiiSelbst joined #nim
10:00:24*KawaiiSelbst quit (Remote host closed the connection)
10:01:10*KawaiiSelbst joined #nim
10:07:05*xtr00 joined #nim
10:09:19*iwuvmika quit (Ping timeout: 250 seconds)
10:14:07*iwuvmika joined #nim
10:35:52*tarzeau quit (Ping timeout: 259 seconds)
11:03:06*iwuvmika quit (Ping timeout: 262 seconds)
11:04:18*iwuvmika joined #nim
11:12:34FromDiscord<Abdulrahman> In reply to @tempestro "that's generally a microoptimization": Its so important physics engines store inverse mass to not divide
11:12:56FromDiscord<Abdulrahman> Not for your everyday applications
11:13:13FromDiscord<Abdulrahman> But for performnace heavy stuff it is not micro is it macro
11:26:57FromDiscord<tempestro> In reply to @abdulrahman.103 "But for performnace heavy": duh!
11:46:21*iwuvmika quit (Ping timeout: 242 seconds)
11:47:47*iwuvmika joined #nim
12:36:20*iwuvmika quit (Ping timeout: 258 seconds)
12:38:13*iwuvmika joined #nim
12:52:46*SchweinDeBurg quit (Quit: WeeChat 4.8.0-dev)
12:57:17*iwuvmika quit (Ping timeout: 260 seconds)
12:58:51*iwuvmika joined #nim
16:23:36FromDiscord<b0rsuk> In reply to @janakali "it's not that it's": Is this true even for integer division?
16:28:17FromDiscord<b0rsuk> WTF. I just read that the way CPUs are designed, integer division is even slower than floating point division.
16:36:22FromDiscord<mratsim> In reply to @b0rsuk "Is this true even": 10x is generous, it's more like 40~60x
16:43:29FromDiscord<b0rsuk> @egbert_37195 Which type(s) are you? https://www.cphiri.dev/presentations/recreational-programming
16:44:18FromDiscord<.bobbbob> Division by a constant will be optimized to a multiply by the inverse by any remotely good compiler, so don't worry about that. Dividing by a variable will use division, but it's fine unless it's in the hot path AND you've benchmarked it to be the bottleneck AND there's a better thing to use. For instance I have to worry about division in a recent DSP project
17:01:45FromDiscord<b0rsuk> But it's something worth knowing about, and a good reason to use `const` whenever possible. Python doesn't have anything like constants.
17:14:31*SchweinDeBurg joined #nim
18:25:21FromDiscord<b0rsuk> Does anyone use the `collect` macro? It has loops in the same order as ordinary loops, which is nice. But it seems impossible to make one-liners with them, like Python. So I don't see much reason to use them. One I can think about is that I can use them with `let` statement (as opposed to `var`), and presumably `const` too. But with `const` I usually want readability.
18:27:03Amun-Rareadability and oneliners
18:30:25Amun-Rahmm, bad gateway on play nim-lang
18:32:27FromDiscord<amun0666> sent a code paste, see https://paste.rs/vFhNT
18:32:48Amun-Raoneliner
18:39:02FromDiscord<b0rsuk> Ah, so the secret sauce is putting it in parentheses, like with inline if.
18:40:22Amun-Rayes
18:41:45FromDiscord<b0rsuk> Hmm, that doesn't look too good. 4 parentheses for the simple case. And if I want to throw in a type annotation, it's even worse.
18:41:49*xtr00 quit (Read error: Connection reset by peer)
18:42:59*xtr00 joined #nim
19:00:10FromDiscord<b0rsuk> On the upside, Nim makes it easy to string together functions as if they were methods, `something.filterIt(..).mapIt(...).strip`. And you can even skip parentheses if you don't need to supply arguments.
19:31:40FromDiscord<gdisuperi> In reply to @abdulrahman.103 "Its so important physics": that doesn't sound quite right, unless the calculations are enough that the cost of accessing memory (caching and the like) is better than the cost of running calculations on the fly
19:31:44FromDiscord<amun0666> Don't write oneliners. It's not perl.
19:32:45FromDiscord<amun0666> sent a code paste, see https://paste.rs/4cS7K
19:36:29FromDiscord<b0rsuk> That's what I was talking about. Unfortunately, this needs 5 imports on average 😉
19:36:56FromDiscord<b0rsuk> I guess it's the way to go though.
19:39:22*SchweinDeBurg quit (Ping timeout: 250 seconds)
19:40:22FromDiscord<Abdulrahman> In reply to @gdisuperi "that doesn't sound quite": Youll have to access some kind of mass anyway to calculate you just convert / mass to inverseMass
19:40:30*SchweinDeBurg joined #nim
20:26:54*jjido joined #nim
20:45:08FromDiscord<b0rsuk> Ok so for people trying to squeeze maximum performance, tricks like multiplying by 0.5 instead of dividing by 2 are routine?↵(I don't write any performance sensitive applications)
20:45:36FromDiscord<b0rsuk> This looks weird, but if it works...
20:54:54Amun-Racompilers are smart enough nowadays
20:55:17Amun-Ra(x shr 1) vs (x div 2) should result in the same code
21:23:26FromDiscord<tempestro> "premature optimization is the root of all evil"
21:23:44FromDiscord<tempestro> In reply to @.bobbbob "Division by a constant": what this guy says, basically
21:29:34*iwuvmika quit (Remote host closed the connection)
21:36:14*iwuvmika joined #nim
22:00:31*SchweinDeBurg quit (Remote host closed the connection)
22:00:42*SchweinDeBurg joined #nim
22:26:16*jjido quit (Ping timeout: 255 seconds)
22:52:11*xutaxkamay quit (Ping timeout: 268 seconds)
22:55:46*xutaxkamay joined #nim
23:05:05FromDiscord<_timurski> In reply to @abdulrahman.103 "Its so important physics": no
23:05:10FromDiscord<_timurski> that's not at all why they do it
23:05:48FromDiscord<_timurski> (edit) "no" => "physics engines use inverse mass because it allows modeling infinite mass geometry without singularities"
23:05:53FromDiscord<_timurski> it's not really a performance thing
23:06:01FromDiscord<_timurski> technically very slightly it is
23:06:01FromDiscord<gesee37> Well there can be many reason and it can be one
23:54:34*iwuvmika quit (Ping timeout: 242 seconds)
23:55:50*xtr00 quit (Read error: Connection reset by peer)