00:59:21 | FromDiscord | <sl0vak_> does nim has a `file` python equivalent? |
01:00:18 | FromDiscord | <Elegantbeef> `currentSourcePath` |
01:07:09 | NimEventer | New Nimble package! gtrends - Google Trends RSS, see https://git.ozzuu.com/thisago/gtrends |
01:12:19 | * | azimut joined #nim |
02:05:20 | FromDiscord | <codic> does anyone know a way to do bcrypt hashing in Nim? |
02:06:17 | FromDiscord | <Elegantbeef> https://nimble.directory/search?query=bcrypt |
02:06:21 | FromDiscord | <codic> all i can find is this https://github.com/runvnc/bcryptnim/blob/master/bcrypt.nim which seems to be unmaintained but is what nimforum uses |
02:06:52 | FromDiscord | <codic> yea seems thats all there is |
02:07:13 | FromDiscord | <codic> i guess i can fork it to fix a bug (doesnt compile under netbsd for me |
02:07:36 | FromDiscord | <arathanis> use the power of learning on the internet to write your own bcrypt library! |
02:07:44 | FromDiscord | <arathanis> then open source it for the rest of us 😇 |
02:08:12 | FromDiscord | <Elegantbeef> Writing crypto from scratch, always will end well |
02:08:38 | FromDiscord | <arathanis> how could it not? |
02:08:58 | FromDiscord | <Elegantbeef> This is atleast relatively simple algo |
02:09:46 | FromDiscord | <Elegantbeef> https://en.wikipedia.org/wiki/Bcrypt#Algorithm how hard could it be! |
02:14:45 | FromDiscord | <arathanis> looks like you just need to implement blowfish and its good to go! |
02:24:59 | FromDiscord | <spotlightkid> https://cheatfate.github.io/nimcrypto/nimcrypto/blowfish.html |
02:33:34 | FromDiscord | <michaelb.eth> In reply to @.john.f.kennedy. "does anyone know a": how about the new-ish `nim-lang/checksums`?↵https://github.com/nim-lang/checksums↵https://nim-lang.github.io/checksums/src/checksums/bcrypt.html#%24%2CHash |
02:36:09 | FromDiscord | <michaelb.eth> https://github.com/nim-lang/checksums/blob/master/src/checksums/bcrypt.nim |
02:49:39 | FromDiscord | <codic> wonderful |
02:49:41 | FromDiscord | <codic> thank you |
03:07:15 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=4AjP |
03:07:51 | FromDiscord | <codic> not Option[T], thats too mess |
03:07:53 | FromDiscord | <codic> (edit) "mess" => "messy" |
03:08:01 | FromDiscord | <Elegantbeef> `echo (try: to(parseJson(str), A) except: """)` |
03:08:13 | FromDiscord | <Elegantbeef> Whoops `except: A()` |
03:08:58 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4AjQ |
03:09:17 | FromDiscord | <codic> yes but that's throwing an exception |
03:09:26 | FromDiscord | <codic> i dont want to do that for every request to an api endpoint that is malformed |
03:09:44 | FromDiscord | <Elegantbeef> You cannot convert Nim's exception code into anything else, no |
03:10:46 | FromDiscord | <Elegantbeef> Yes there is `nim-results` and friends but those just wrap exceptions into results |
03:10:52 | FromDiscord | <michaelb.eth> you can wrap it with nim-results |
03:10:56 | FromDiscord | <michaelb.eth> ha! beat me to it |
03:11:07 | FromDiscord | <codic> no i dont hate exceptions |
03:11:13 | FromDiscord | <codic> my concern is that throwing an exception would be slow |
03:11:23 | FromDiscord | <Elegantbeef> It can be |
03:11:24 | FromDiscord | <codic> when it comes to an often hit endpoint |
03:11:33 | FromDiscord | <codic> since it's not an application error, its an user error |
03:12:03 | FromDiscord | <codic> so i want to default the fields to blank and then i can just check if x.y == "" |
03:12:11 | FromDiscord | <Elegantbeef> There is the `std/parsejson` module |
03:13:25 | FromDiscord | <Elegantbeef> The nim stdlib is generally designed for exceptions in mind which can be a shame |
03:17:01 | FromDiscord | <codic> is there another json library that would allow me to do this? otherwise Ig exceptions work for now |
03:17:15 | FromDiscord | <michaelb.eth> @codic maybe take a look at the `json_serialization` lib. I'm not sure atm if it will be better or worse re: your concerns, but it does take a different approach: https://github.com/status-im/nim-json-serialization/ |
03:17:19 | FromDiscord | <michaelb.eth> (edit) "https://github.com/status-im/nim-json-serialization/" => "https://github.com/status-im/nim-json-serialization" |
03:17:49 | FromDiscord | <huantian> jsony might work better too |
03:18:03 | FromDiscord | <huantian> it handles missing keys by simply keeping the default value |
03:18:12 | FromDiscord | <michaelb.eth> also, though I don't have experience with it (yet), maybe `jsony`: https://github.com/treeform/jsony |
03:18:40 | FromDiscord | <codic> In reply to @huantian "it handles missing keys": yes this is what I need |
03:18:45 | FromDiscord | <codic> thank you I’ll take a look |
03:21:51 | FromDiscord | <Elegantbeef> Well jsonutils also exists |
03:22:08 | FromDiscord | <Elegantbeef> Can write your own hook that doesnt error on keys missing |
03:49:56 | FromDiscord | <arathanis> In reply to @huantian "it handles missing keys": is there a way to cause it to have an error if the value is missing? |
03:50:11 | FromDiscord | <arathanis> if that functionality is desired, of course |
04:03:29 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/jsonutils.html#Joptions |
04:03:47 | FromDiscord | <arathanis> ah that is cool |
04:03:53 | FromDiscord | <arathanis> i wonder if something similar exists for jsony |
04:04:08 | FromDiscord | <arathanis> how does jsonutils interact with json? |
04:04:15 | FromDiscord | <arathanis> (edit) "jsonutils" => "std/jsonutils" | "json?" => "std/json?" |
04:04:24 | FromDiscord | <Elegantbeef> It uses JsonNodes and default hooks |
04:04:32 | FromDiscord | <Elegantbeef> You can override the hooks to do whatever you want though |
04:04:39 | FromDiscord | <arathanis> but is otherwise separate from std/json? |
04:04:46 | FromDiscord | <arathanis> oh no it imports std/json |
04:04:51 | FromDiscord | <arathanis> so its built on top of it |
04:07:54 | FromDiscord | <Elegantbeef> Well yea it uses JsonNode and the default deserialisation |
05:09:11 | * | azimut_ joined #nim |
05:11:38 | * | azimut quit (Ping timeout: 240 seconds) |
05:15:39 | * | ntat joined #nim |
06:07:38 | * | azimut_ quit (Ping timeout: 240 seconds) |
06:09:20 | * | azimut joined #nim |
06:18:14 | NimEventer | New post on r/nim by h234sd: Keep, Note Taking App in Nim, see https://reddit.com/r/nim/comments/14witww/keep_note_taking_app_in_nim/ |
06:44:55 | * | PMunch joined #nim |
06:45:19 | PMunch | Hmm, does the async runtime leak descriptors? |
06:46:38 | PMunch | I have some code which gets data from one server, calculates something, and publishes the result over MQTT to another server. The MQTT and HTTP (stdlib) implementations are both async, but I just use waitFor at the moment for testing purposes |
06:47:09 | PMunch | Today I came back to a crashed script with the error: Exception message: Maximum number of descriptors is exhausted! [IOSelectorsException] |
07:08:36 | * | ovenpasta joined #nim |
07:16:19 | FromDiscord | <huantian> Maybe you have too many unclosed http clients? |
07:16:24 | FromDiscord | <huantian> Random guess tho |
07:18:56 | PMunch | Hmm, I guess there is a small possibility that would happen in certain error scenarios |
07:19:22 | FromDiscord | <arathanis> certain errors leave clients open? |
07:19:30 | FromDiscord | <arathanis> can you make a jira ticket for that bug? 😎 |
07:19:39 | NimEventer | New thread by alexeypetrushin: Keep, Note Taking App in Nim, see https://forum.nim-lang.org/t/10331 |
07:20:43 | PMunch | Well I have some helper procedures which create a HttpClient, tries to get some data, and then closes the HttpClient. If one of these errors out it would raise the exception before the client got closed |
07:21:04 | PMunch | Jira ticket? Since when does Nim have a Jira? |
07:21:16 | FromDiscord | <arathanis> you dont use JIRA for your personal projects? |
07:21:33 | FromDiscord | <arathanis> would `defer` help solve it? |
07:24:37 | PMunch | Well, this is a work project, not a personal project. And since I'm the only programmer on this project I don't think adding a bug in Jira would help me.. |
07:24:58 | PMunch | And I definitely don't use that crap for personal projects, even trying my best to phase it out at work.. |
07:25:09 | PMunch | I think a `try: finally:` would work well |
08:14:03 | * | user__ joined #nim |
08:17:55 | * | ovenpasta quit (Ping timeout: 240 seconds) |
08:19:39 | PMunch | Hmm, is `from` a keyword only so that `import x from y` works? Or is it used for anything else? |
08:20:01 | PMunch | It's a bit annoying not being able to create a procedure with to/from arguments.. |
08:27:24 | * | xet7 quit (Ping timeout: 246 seconds) |
08:34:35 | FromDiscord | <odexine> src dest |
08:34:42 | FromDiscord | <odexine> I often use that instead |
08:35:17 | PMunch | Doesn't make much sense when I'm passing in a DateTime :P |
08:36:11 | FromDiscord | <odexine> Start stop |
08:36:21 | PMunch | Yeah that's what I ended up with |
08:36:51 | PMunch | But since I'm wrapping a web-API which uses to/from it feels a bit awkward to have to switch to start/stop in my code.. |
08:46:43 | * | xet7 joined #nim |
09:05:18 | * | Batzy quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
09:05:47 | * | Batzy joined #nim |
09:08:29 | PMunch | Hmm, have anyone created a natural language timestamp thing for Nim? |
09:08:49 | PMunch | So you could say something like `yesterday` or `two weeks ago` and it would understand it? |
09:14:32 | * | Batzy quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
09:15:47 | * | Batzy joined #nim |
09:22:52 | PMunch | Something like chronic |
09:37:27 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4AkF |
09:41:08 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4AkH |
09:52:48 | FromDiscord | <jmgomez> In reply to @heysokam "oh, it was the": It was discussed recently in #internals https://discord.com/channels/371759389889003530/768367394547957761/1123655395517419552 |
09:55:56 | FromDiscord | <heysokam> In reply to @jmgomez "It was discussed recently": ah i see. ty for the link, didn't know about those concepts at all ✍️ |
10:12:06 | * | jmdaemon quit (Ping timeout: 245 seconds) |
10:18:06 | FromDiscord | <pietroppeter> In reply to @PMunch "Something like chronic": TIL https://github.com/alexherbo2/chronic interesting! |
10:19:31 | PMunch | Oh, I was actually talking about this: https://github.com/mojombo/chronic |
10:44:30 | PMunch | Hmm, all the setters like `year=` are deprecated since 1.3.1, what am I supposed to replace them with? |
10:48:19 | FromDiscord | <intellij_gamer> iirc you recreate the `DateTime` |
10:49:03 | PMunch | Well that's cumbersome.. |
10:56:10 | FromDiscord | <pietroppeter> In reply to @PMunch "Oh, I was actually": Ha, I Guess that might be the original, the Crystal one is the first I found… |
10:57:52 | FromDiscord | <pietroppeter> It would also make sense for a Nim-like chronic (a chronim?) to be able to serialize time stamp to natural language (to be used in JS backend..) |
10:58:39 | PMunch | Huh? |
10:58:43 | PMunch | For display purposes? |
10:58:54 | PMunch | The problem there is that you have multiple valid representations |
10:59:59 | FromDiscord | <Andreas> sent a long message, see http://ix.io/4Al0 |
11:00:24 | PMunch | "First Monday of the month", "2023-07-03", "July 3rd", and "one week after June 26th" are all the same date |
11:01:11 | PMunch | Uhm.. |
11:01:32 | * | nils` quit (Ping timeout: 240 seconds) |
11:01:34 | PMunch | Andreas, I believe the PNode is more or less the exact same structure as a NimNode. |
11:01:43 | FromDiscord | <Andreas> (edit) "http://ix.io/4Al0" => "http://ix.io/4Al2" |
11:02:02 | FromDiscord | <Andreas> In reply to @PMunch "<@754284517316886598>, I believe the": yep, thats my impression, too. |
11:02:37 | PMunch | Why not just use nimsuggest? |
11:03:37 | FromDiscord | <Andreas> In reply to @PMunch "Why not just use": can nimsuggest deliver proc-signatures ? i want to put the structure/outline into a editor-view.. |
11:04:12 | PMunch | Hmm, don't quite remember |
11:04:27 | PMunch | LSP does all of this stuff automatically |
11:05:07 | PMunch | I don't quite remember how it pulls this information, but if NimLSP is able to do it then nimsuggest should be able to |
11:09:05 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4Al4 |
11:09:21 | FromDiscord | <heysokam> (edit) "https://play.nim-lang.org/#ix=4Al4" => "https://play.nim-lang.org/#ix=4Al5" |
11:13:34 | FromDiscord | <Andreas> In reply to @PMunch "LSP does all of": hmm, maybe i'm looking at the wrong place, but neither nimLime nor nimPlus regard type-definitions as symbols - so they won't show up in the editor. |
11:15:14 | PMunch | Hmm, not 100% sure what you mean Andreas |
11:18:48 | FromDiscord | <Andreas> In reply to @PMunch "Hmm, not 100% sure": would you agree that `type MyType = object ... ` defines a `symbol` ? Or does symbol only include `proc/iterator/func/method/converter` ? |
11:25:26 | PMunch | Yeah I'd say "MyType" is a symbol |
11:26:42 | FromDiscord | <Andreas> In reply to @PMunch "Yeah I'd say "MyType"": me too. In SublimeText they are not. So the UI-Menue."Goto Symbol" does not include user-defined types/enums etc.. |
11:45:26 | * | m5zs7k quit (Ping timeout: 245 seconds) |
11:47:08 | * | m5zs7k joined #nim |
12:15:06 | FromDiscord | <pietroppeter> In reply to @PMunch "For display purposes?": Yep, for display purposes and you should have a default representation and options to change formatting (1d vs yesterday, 1w vs one week ago). This is anyway something that is done everywhere (on Nim forum too you translate timestamps to 1h, 1w, …) and it is probably something very simple and the complexity lies in parsing. Still, it seems something useful to have as a library |
12:17:06 | PMunch | Hmm, I guess that would be handy |
12:17:21 | PMunch | Should be pretty simply to rip that part out of the forums though |
12:17:32 | PMunch | The natural parsing of dates is a bit trickier |
12:18:59 | PMunch | Bonus points if you can do something like "every 1st Monday" and get a closure iterator you can use to get the first Monday of every month. |
12:27:27 | ntat | I am looking for the correct name of these two data structures. Are these the correct names? ↓ |
12:27:39 | ntat | https://play.nim-lang.org/#ix=4Alv |
12:28:44 | FromDiscord | <mratsim> sent a code paste, see https://play.nim-lang.org/#ix=4Alx |
12:45:24 | PMunch | ntat, which data structures? |
12:45:31 | PMunch | That's just an object with some fields.. |
13:00:38 | ntat | PMunch, I mean, what is p1 in this code? In Python p1 would be an object. |
13:02:11 | PMunch | ntat, well in Nim p1 is also an object, of type Person |
13:08:47 | ntat | PMunch, So I have two objects: Person and p1? Person looks like a class in Python. |
13:09:01 | FromDiscord | <michaelb.eth> In reply to @ntat "<@696333749570371585>, So I have": `type Person` is a type |
13:09:18 | FromDiscord | <michaelb.eth> `p1` is an instance of that type |
13:09:29 | PMunch | Well no, you have one type which is called Person and which is an object definition. Then p1 is an instance of this object type |
13:10:45 | PMunch | Classes as such don't really exist in Nim. A class is basically an object + some functions. In Nim we just have objects and functions which take the object as an argument. The distinction is minor though |
13:13:47 | ntat | PMunch, michaelb.eth, OK, that's a little different from Python, though. Thanks for the explanation :) |
13:14:06 | FromDiscord | <michaelb.eth> note: Nim is quite different from Python |
13:14:08 | PMunch | You'll find a lot of things are different from Python in Nim. |
13:14:35 | PMunch | It's basically just vaguely familiar in syntax, but apart from that it works almost completely different |
13:15:04 | PMunch | It's like comparing C and Java, sure they look kinda similar with braces and such, but they behave completely differently |
13:15:06 | * | PMunch quit (Quit: Leaving) |
14:21:41 | * | rockcavera joined #nim |
14:35:48 | FromDiscord | <ambient3332> How do I set the compilation root for gcc when creating libraries with {.compile.} pragme? |
14:36:33 | FromDiscord | <ambient3332> it uses the current directory where I run Nim from, but it should use the library root |
14:40:57 | FromDiscord | <bostonboston> Are you looking for --outdir: or something else |
14:41:24 | FromDiscord | <ambient3332> @Boston https://github.com/amb/nim_audiobook/blob/no-arraymancer/otfft-simple/otfft.nim |
14:41:34 | FromDiscord | <ambient3332> I want to import that from anywhere |
14:46:34 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4Am2 |
14:59:12 | FromDiscord | <ambient3332> Thanks, bu that seems hack-ish. I might have to look into creating an actual library with Nimble |
15:03:23 | FromDiscord | <jmgomez> Im not sure what you attempt to do but you could also just pass the search path as absolute instead of `.` |
15:04:08 | FromDiscord | <jmgomez> making it like that as nimble will make it fragile anyways |
15:04:53 | FromDiscord | <ambient3332> I'm aiming to create a Nim library that compiles the included c and cpp files, something like https://github.com/treeform/staticglfw probably |
15:06:04 | FromDiscord | <ambient3332> Although the C++ compilation takes forever, so it has absolutely has to be cached after the first run |
15:08:01 | FromDiscord | <demotomohiro> How about to compile it as a static or dynamic library and link it with `--passL` pragma?↵https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-passl-pragma |
15:08:25 | FromDiscord | <ambient3332> Is it something I can do automatically through Nim? |
15:10:25 | FromDiscord | <jmgomez> In reply to @ambient3332 "Although the C++ compilation": how long is forever? It will be cached automatically |
15:10:29 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4Amg |
15:12:35 | FromDiscord | <demotomohiro> sent a long message, see http://ix.io/4Amh |
15:12:51 | FromDiscord | <ambient3332> Not everyone is on Linux |
15:13:02 | FromDiscord | <ambient3332> plus I think I fixed it just by removing the "-I." from .compile pragma |
15:13:44 | FromDiscord | <ambient3332> @jmgomez about 15 minutes |
15:13:45 | FromDiscord | <demotomohiro> Windows have package manager like msys2 or conan. |
15:17:01 | FromDiscord | <jmgomez> In reply to @ambient3332 "plus I think I": that's crazy, only once or every time you recompile? |
15:17:15 | FromDiscord | <ambient3332> In reply to @jmgomez "that's crazy, only once": Every time I have to recompile the C++ files |
15:17:36 | FromDiscord | <ambient3332> gcc uses very little CPU while doing it, vcc seems to be more than order of magnitude faster |
15:24:44 | FromDiscord | <demotomohiro> Doesn't that C++ library use make, cmake or meson?↵If it uses make, you need to add -j option so that it compile multiple .cpp file at parallel. |
15:24:59 | FromDiscord | <ambient3332> It's just a single file C++ that chokes gcc |
15:25:22 | FromDiscord | <michaelb.eth> In reply to @ambient3332 "It's just a single": what about clang, similar choke? |
15:25:40 | FromDiscord | <ambient3332> I only tried vcc, and it utilizes all cores |
15:34:54 | FromDiscord | <System64 ~ Flandre Scarlet> Is there a better Multithread thing than Spawn? |
15:58:09 | FromDiscord | <ezquerra> malebolgia? https://github.com/Araq/malebolgia↵I think other options are weave, nim taskpools and another one called chronos (I think?) from @mratsim |
16:01:18 | * | azimut quit (Ping timeout: 240 seconds) |
16:05:04 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ezquerra "malebolgia? https://github.com/Araq/malebolgia I th": Sounds interesting! And are performances better? |
16:26:36 | FromDiscord | <ezquerra> In reply to @sys64 "Sounds interesting! And are": I haven’t used them myself but I believe that they have different performance trade offs |
16:30:01 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ezquerra "I haven’t used them": Why do I have errors? https://media.discordapp.net/attachments/371759389889003532/1128362570093445180/message.txt |
16:31:40 | FromDiscord | <spotlightkid> It sounds like you're making an audio application? Then I don't think any async solution will meet the realtime requirements.↵I would use normal Nim threads and use channels to send wave data between the realtime and disk threads. |
16:31:50 | FromDiscord | <ezquerra> In reply to @sys64 "Why do I have": I’m not the right person to answer but first thing is check is whether you are using the right version of nim. Malévolos might need the current development version |
16:32:00 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @spotlightkid "It sounds like you're": It's for wav export |
16:32:17 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ezquerra "I’m not the right": I use Nim 1.9 |
16:32:27 | FromDiscord | <spotlightkid> While playback is going on or "offline"? |
16:33:01 | FromDiscord | <ezquerra> In reply to @sys64 "I use Nim 1.9": Then probably your best bet is to ping @_araq or write a post on the nim forum |
16:33:03 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @spotlightkid "While playback is going": The entire synth context is copied |
16:36:41 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4AmS |
16:37:07 | FromDiscord | <System64 ~ Flandre Scarlet> oh it's a runtime error |
16:46:07 | FromDiscord | <_araq> look at me, do I look like I appreciate highlighting. |
16:51:30 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @_araq "look at me, do": Wdym? |
16:53:10 | FromDiscord | <odexine> highlighting -> pings |
16:55:21 | FromDiscord | <heysokam> you probably want to mark the channel notifications as `@nothing` if you don't want to be pinged, Araq↵I feel like you are a person important enough to attract pings, so it makes perfect sense that people do that and its probably just simpler if you disable the feature and ignore them, since it will definitely happen again (people are not mind-readers, basically, since pings are a normal thing in discord, hence why the feature to disab |
16:56:08 | FromDiscord | <graveflo> but then he doesn't get to scold them. I imagine there is some fun in that at least |
17:00:00 | * | deadmarshal_ quit (Remote host closed the connection) |
17:09:17 | FromDiscord | <xtrayambak> Are there any plans to replace std/random with a pure solution? |
17:10:06 | FromDiscord | <xtrayambak> Actually, when I think about it, a semver parser in the stdlib would be nice too. |
17:15:55 | NimEventer | New thread by TKD: Table lookup problem, see https://forum.nim-lang.org/t/10332 |
17:43:53 | * | jmdaemon joined #nim |
17:57:12 | NimEventer | New thread by mantielero: Crosscompiling - SSL, see https://forum.nim-lang.org/t/10333 |
18:15:32 | * | deadmarshal_ joined #nim |
18:21:28 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4Ang |
18:22:47 | FromDiscord | <heysokam> (edit) "https://play.nim-lang.org/#ix=4Ang" => "https://play.nim-lang.org/#ix=4Anh" |
18:27:13 | FromDiscord | <heysokam> `attr` vs `atrr` 🤦♂️ |
18:56:05 | FromDiscord | <odexine> hey at least you now know you're blind haha |
19:10:31 | FromDiscord | <System64 ~ Flandre Scarlet> Is it possible to profile performances of a Nim program? |
19:11:02 | FromDiscord | <ambient3332> Yep, just attach it to a sampling profiler and add debug info |
19:11:24 | FromDiscord | <System64 ~ Flandre Scarlet> sampling profiler? |
19:11:55 | FromDiscord | <ambient3332> for example: https://github.com/VerySleepy/verysleepy |
19:19:40 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ambient3332 "for example: https://github.com/VerySleepy/veryslee": I don't see the Nim functions |
19:21:33 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=4Anr |
19:24:25 | FromDiscord | <System64 ~ Flandre Scarlet> why compiling in Release? |
19:24:53 | FromDiscord | <ambient3332> to get accurate picture of where the time is spent. debug removes ton of optimizations and will report all kinds of nonsense, that I don't presonally need |
19:25:45 | FromDiscord | <ambient3332> although inlining can also confuse things, I usually try to find a good balance where I can get the idea where the hot loops are |
19:26:24 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ambient3332 "although inlining can also": Oh, I use a lot of inlines |
19:26:57 | FromDiscord | <ambient3332> it just mean you have to figure out yourself which part of the code it is, as inlining changes the end result from your actual code |
19:27:03 | FromDiscord | <System64 ~ Flandre Scarlet> Thanks to ImGUI that throws compiler errors when I not Inline |
19:27:25 | FromDiscord | <System64 ~ Flandre Scarlet> I used NimProf, I have that https://media.discordapp.net/attachments/371759389889003532/1128407217117339829/message.txt |
19:27:29 | FromDiscord | <ambient3332> imgui should be popular enough to have lot of info about profiling |
19:33:30 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4Anv |
19:36:42 | FromDiscord | <ambient3332> Well it should give you an overview of where the time is spent in your code. It does not do that? |
19:38:23 | FromDiscord | <System64 ~ Flandre Scarlet> Not really |
19:38:56 | FromDiscord | <System64 ~ Flandre Scarlet> Like, only that for Kurumi-X https://media.discordapp.net/attachments/371759389889003532/1128410113967923322/image.png |
19:39:21 | FromDiscord | <ambient3332> You can sort and navigate the project in the different panes |
19:39:35 | FromDiscord | <ambient3332> And it should also show how much time is spent in each line of code |
19:45:38 | FromDiscord | <System64 ~ Flandre Scarlet> I think this module is the bottleneck https://media.discordapp.net/attachments/371759389889003532/1128411798962450543/image.png |
19:47:12 | FromDiscord | <ambient3332> You could add processing time text over each node. That's super useful in most node based real-time systems |
19:47:34 | FromDiscord | <System64 ~ Flandre Scarlet> Ah yeah can help a lot |
19:49:13 | FromDiscord | <System64 ~ Flandre Scarlet> Btw are that kind of loops unrolled on Release? (LENGTH is a constant) https://media.discordapp.net/attachments/371759389889003532/1128412700955922442/image.png |
19:50:03 | FromDiscord | <ambient3332> I think loop unrolling is based on loop length in most compilers, but you can always force it if you want with flags |
19:51:18 | FromDiscord | <ambient3332> Probably not correct but just off the top of my head: --passc:"--funroll-loops" (for gcc) |
19:51:55 | FromDiscord | <System64 ~ Flandre Scarlet> gotta try this |
19:55:36 | FromDiscord | <System64 ~ Flandre Scarlet> Humm seems it doesn't change a lot of things |
19:58:14 | FromDiscord | <ambient3332> Try -d:lto |
19:59:09 | FromDiscord | <ambient3332> (if you're creating -d:danger or -d:release builds that is) |
20:00:10 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4Any |
20:00:39 | FromDiscord | <ambient3332> also depending on what Nim version you're using --mm:arc and -d:useMalloc might change things a bit |
20:02:53 | FromDiscord | <ambient3332> on Windows using mimalloc can give significant performance boost depending on what your'e doing |
20:03:02 | FromDiscord | <ambient3332> but that's not a simple compiler flag... |
20:03:20 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ambient3332 "but that's not a": manual memory management? |
20:03:27 | FromDiscord | <ambient3332> https://github.com/microsoft/mimalloc |
20:04:31 | FromDiscord | <ambient3332> also does -o3 register as -O3 (it's -O3 everywhere I've seen it) |
20:05:08 | FromDiscord | <ambient3332> also -O3 implies -funroll-loops and a lot of other stuff IIRC |
20:05:52 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ambient3332 "also does -o3 register": Ah maybe I should try this↵Also Mimalloc sounds interesting!↵Is it easy to put this in place? |
20:06:17 | FromDiscord | <ambient3332> I haven't tried it much with Nim but in Rust it was just adding a few lines in cargo.toml |
20:06:38 | FromDiscord | <System64 ~ Flandre Scarlet> It needs a module for Nim |
20:07:19 | FromDiscord | <ambient3332> well there's this but haven't tried it https://github.com/Yardanico/mimalloc_nim |
20:10:24 | FromDiscord | <System64 ~ Flandre Scarlet> I should try it |
20:13:34 | * | LyndsySimon quit (Quit: Connection closed for inactivity) |
20:14:04 | FromDiscord | <System64 ~ Flandre Scarlet> Does it really modify the file? https://media.discordapp.net/attachments/371759389889003532/1128418952356298905/image.png |
20:15:42 | FromDiscord | <ambient3332> It seems mimalloc might be in devel https://github.com/nim-lang/Nim/pull/20359#issuecomment-1253880181 |
20:16:10 | om3ga | required type for self: Widget. but expression 'uiWidget[]' is of type: Widget |
20:16:29 | om3ga | awesome |
20:20:47 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=4AnG |
20:21:13 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ambient3332 "<@380360389377916939> in Nim devel": so Nim 1.9? |
20:21:43 | FromDiscord | <ambient3332> 1.9.5 2023-07-11 |
20:22:04 | FromDiscord | <System64 ~ Flandre Scarlet> sent a long message, see https://paste.rs/5mFWO |
20:22:39 | FromDiscord | <ambient3332> although might be faulty benchmarking on my end. someone actually knowing this should chime in |
20:24:26 | * | LyndsySimon joined #nim |
20:24:30 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ambient3332 "although might be faulty": Well, I checked in Nim files, no any mention to Mimalloc |
20:28:09 | FromDiscord | <michaelb.eth> In reply to @sys64 "Well, I checked in": What compiler are you using on Windows? |
20:45:00 | FromDiscord | <michaelb.eth> the reason I ask is that back when Araq was asking for people to benchmark some code related to malebolgia, it was found that mingw gcc was producing an executable for the multithreaded program that performed much slower than executables produced by clang and microsoft's compilers |
20:45:20 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @michaelb.eth "What compiler are you": gcc |
20:45:29 | FromDiscord | <michaelb.eth> finding the discussion, just a sec |
20:45:43 | FromDiscord | <System64 ~ Flandre Scarlet> well↵g++ since I compile to C++ |
20:46:29 | FromDiscord | <michaelb.eth> https://discord.com/channels/371759389889003530/768367394547957761/1105201319154831420 |
20:47:22 | FromDiscord | <michaelb.eth> if I understood correctly from the discussion above, you're doing something multithreaded, so if you're having perf issues, might be a good idea to give clang a try |
20:47:39 | FromDiscord | <System64 ~ Flandre Scarlet> So I need to do -cc:clang? |
20:47:43 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "-cc:clang?" => "--cc:clang?" |
20:48:24 | FromDiscord | <michaelb.eth> not sure, I was compiling in an MSYS2 CLANG64 environment, where the default compiler is clang, so I didn't need to twiddle compiler flags |
20:48:29 | FromDiscord | <System64 ~ Flandre Scarlet> Btw I only use multithread for file export, otherwise it's single thread |
20:49:01 | FromDiscord | <michaelb.eth> I see, well then maybe it won't make a difference, just something to be aware of re: mingw gcc |
20:51:47 | FromDiscord | <System64 ~ Flandre Scarlet> I have errors under clang https://media.discordapp.net/attachments/371759389889003532/1128428447308447917/message.txt |
21:06:38 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4AnQ |
21:08:12 | FromDiscord | <System64 ~ Flandre Scarlet> Is it possible to get rid of all those DLLs? The exe requires them to work https://media.discordapp.net/attachments/371759389889003532/1128432578110705674/image.png |
21:09:03 | FromDiscord | <ambient3332> well if you include a gcc environment, the dll's need to be somewhere. using MS compilers has the advantage that the dll's are often already in system path |
21:09:06 | FromDiscord | <heysokam> In reply to @sys64 "Is it possible to": link statically |
21:16:10 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @heysokam "link statically": How can I do that? |
21:19:14 | FromDiscord | <heysokam> In reply to @sys64 "How can I do": you need to compile the libraries into an `.a` file (each library might have its own way, or not have the option at all) and then you `{.link: "theFile.a".}` in some of your files |
21:20:42 | FromDiscord | <heysokam> @System64 ~ Flandre Scarlet https://github.com/heysokam/wgpu/blob/4af685fae23d7eaa38c41deab52081b7d5e73b7d/src/wgpu/compile.nim#L81-L83 |
21:21:17 | FromDiscord | <heysokam> similar to that, but depends on each of the libraries you want to link statically. will need to google for those you have there |
21:21:52 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright↵But aren't they already compiled into a .a? |
21:22:21 | FromDiscord | <heysokam> glib is usually linked dynamically, so probably not |
21:22:32 | FromDiscord | <heysokam> unless you get some binaries already prebuilt somewhere |
21:22:55 | FromDiscord | <heysokam> (edit) "glib" => "libc" |
21:24:57 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @heysokam "libc is usually linked": Ah alright |
21:25:10 | FromDiscord | <System64 ~ Flandre Scarlet> I can use clang but I have errors with clangs |
21:25:18 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @sys64 "I have errors under": Those ones |
21:26:28 | FromDiscord | <heysokam> i know nothing about those myself, sry |
21:34:20 | * | ntat quit (Quit: Leaving) |
21:43:51 | * | azimut joined #nim |
22:03:55 | * | user__ quit (Ping timeout: 240 seconds) |
22:12:32 | * | azimut quit (Remote host closed the connection) |
22:12:43 | * | azimut_ joined #nim |
22:22:58 | FromDiscord | <liathekitten> Is there an easy way to only get the first 2 lines in a file |
22:26:31 | * | disso_pch quit (Quit: Leaving) |
22:29:43 | FromDiscord | <heysokam> In reply to @liathekitten "Is there an easy": https://nim-lang.org/docs/io.html#readLines%2Cstring%2CNatural |
22:29:47 | FromDiscord | <michaelb.eth> In reply to @liathekitten "Is there an easy": `readLines`?↵https://nim-lang.org/docs/io.html#readLines%2Cstring%2CNatural |
22:30:04 | FromDiscord | <liathekitten> Ok |
22:42:17 | * | jmdaemon quit (Ping timeout: 245 seconds) |
23:02:31 | * | jmd_ joined #nim |
23:55:17 | * | cm_ joined #nim |
23:56:03 | * | cm quit (Ping timeout: 258 seconds) |
23:56:03 | * | cm_ is now known as cm |