00:52:30 | * | laaron joined #nim |
01:19:04 | * | endragor joined #nim |
02:09:44 | * | endragor quit (Remote host closed the connection) |
02:50:40 | * | lritter quit (Ping timeout: 246 seconds) |
02:51:25 | * | lritter joined #nim |
03:04:59 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
03:05:29 | * | laaron joined #nim |
03:24:13 | * | endragor joined #nim |
03:32:45 | * | endragor_ joined #nim |
03:33:04 | * | endragor quit (Read error: Connection reset by peer) |
03:38:26 | FromGitter | <kayabaNerve> ```code paste, see link``` ⏎ ⏎ :/ [https://gitter.im/nim-lang/Nim?at=5d562531029a51607fa118f2] |
03:38:35 | FromGitter | <kayabaNerve> Thankfully, it appears to be a fluke. |
03:40:02 | FromGitter | <kayabaNerve> Well. 1/4 runs so far... |
03:44:25 | * | laaron quit (Remote host closed the connection) |
03:52:13 | * | PrimHelios_ joined #nim |
03:52:37 | * | PrimHelios quit (Ping timeout: 258 seconds) |
04:02:28 | * | NimBot joined #nim |
04:28:55 | * | rayman22201 quit (Quit: Connection closed for inactivity) |
04:33:53 | * | rayman22201 joined #nim |
04:41:11 | * | rockcavera quit (Remote host closed the connection) |
04:49:33 | * | nsf joined #nim |
05:35:00 | * | terps joined #nim |
05:42:55 | * | narimiran joined #nim |
06:21:24 | * | PMunch joined #nim |
06:32:28 | * | terps quit (Ping timeout: 264 seconds) |
06:44:25 | * | solitudesf joined #nim |
06:48:29 | * | shomodj joined #nim |
06:48:55 | * | rayman22201 quit (Quit: Connection closed for inactivity) |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:03:39 | * | krux02 joined #nim |
07:04:42 | * | gmpreussner joined #nim |
07:46:54 | FromGitter | <alehander42> ohhow does it happen ? |
07:48:48 | * | shomodj quit (Ping timeout: 245 seconds) |
07:55:52 | * | shomodj joined #nim |
08:00:04 | * | shomodj quit (Ping timeout: 246 seconds) |
08:06:25 | * | shomodj joined #nim |
08:07:01 | FromGitter | <kayabaNerve> It's some async bug. It happened almost immediately on boot but I'm working with automated testing. |
08:07:46 | FromGitter | <kayabaNerve> I added a print statement to the try catch because an Exception was being triggered, and catching the exception of an async function from within an async function... |
08:08:13 | FromGitter | <kayabaNerve> Anyways. Codebase is unfortunately too large for me to try to create a MWE. Didn't even bother creating a commit gist combo... probably should've. |
08:10:45 | * | shomodj quit (Ping timeout: 244 seconds) |
08:20:58 | * | terps joined #nim |
08:24:19 | * | floppydh joined #nim |
08:44:12 | * | actuallybatman quit (Ping timeout: 245 seconds) |
08:45:32 | * | shomodj joined #nim |
08:52:16 | * | sammich quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
08:53:25 | * | abm joined #nim |
08:53:27 | * | sammich joined #nim |
09:02:25 | * | chemist69 joined #nim |
09:13:14 | * | ng0 joined #nim |
09:14:12 | * | terps quit (Ping timeout: 245 seconds) |
09:19:48 | * | absolutejam joined #nim |
09:21:22 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:28:47 | * | terps joined #nim |
09:50:19 | * | shomodj joined #nim |
09:50:55 | * | shomodj_ joined #nim |
09:54:53 | * | shomodj quit (Ping timeout: 258 seconds) |
10:15:03 | * | terps quit (Ping timeout: 245 seconds) |
10:28:17 | * | hugogranstrom joined #nim |
10:37:18 | livcd | https://szibele.com/memory-footprint-of-gui-toolkits/chart.svg |
10:41:59 | * | stefanos82 joined #nim |
10:48:00 | kungtotte | The biggest issue with Electron apps isn't their memory use, it's that every app ships their own Electron. |
10:52:12 | * | hugogranstrom quit (Ping timeout: 272 seconds) |
10:58:07 | * | terps joined #nim |
11:14:49 | Araq | the biggest issue with Electron is that immediately you inherit all the browser's security problems |
11:18:48 | * | terps quit (Ping timeout: 272 seconds) |
11:33:12 | FromGitter | <arnetheduck> given that a fair amount of effort has gone into the security of electron, it might very well be that running inside of electron might on average be better than whatever code you're able to produce yourself, and the sandbox will protect you from your own *mostly bad* code |
11:37:16 | Araq | depends. if your app doesn't need network connections the browser is the last thing to base your UI on |
11:43:54 | * | clyybber joined #nim |
11:48:15 | * | terps joined #nim |
11:54:42 | * | rockcavera joined #nim |
12:09:27 | * | terps quit (Ping timeout: 250 seconds) |
12:11:06 | FromGitter | <alehander42> after 5 years electron will run wasm on gpu in ring 0 in electron-os and we will be all finished |
12:11:24 | FromGitter | <alehander42> (this, but half-seriously) |
12:12:33 | FromGitter | <mratsim> There is WebGPU |
12:12:58 | FromGitter | <mratsim> https://en.wikipedia.org/wiki/WebGPU |
12:21:03 | * | Kaivo joined #nim |
12:36:49 | Araq | alehander42: btw https://github.com/pragmagic/karax/pull/110 |
12:37:01 | Araq | should fix the known performance problems |
12:40:17 | FromGitter | <alehander42> awesoe! |
12:40:26 | FromGitter | <alehander42> awesome* |
12:40:41 | FromGitter | <alehander42> i am using a fork based on an old version of the diff algorithm |
12:40:57 | FromGitter | <alehander42> but i'll try this one these days |
12:41:20 | * | nsf quit (Quit: WeeChat 2.4) |
12:41:37 | * | shomodj joined #nim |
12:42:05 | FromGitter | <alehander42> does toDom work now |
12:42:25 | FromGitter | <alehander42> i am using vnodeToDom in several places (where i need to dynamically pass html created by a view) |
12:42:52 | * | absolutejam quit (Ping timeout: 246 seconds) |
12:43:21 | FromGitter | <alehander42> what i mean is, does it work in the same way: do i need to useAttachedNode when i manually use it? |
12:43:47 | FromGitter | <alehander42> it seems it just caches it ok |
12:45:01 | * | endragor_ quit (Remote host closed the connection) |
12:45:34 | * | shomodj_ quit (Ping timeout: 272 seconds) |
12:47:13 | * | absolutejam joined #nim |
12:53:10 | Araq | alehander42: vnodeToDom still exists and behaves as before |
12:53:58 | FromGitter | <alehander42> ok |
12:54:12 | FromGitter | <alehander42> btw i run usually several instances of karax |
12:54:47 | FromGitter | <alehander42> as i use a resizable layout engine and put a karax instance in each panel |
12:55:07 | FromGitter | <alehander42> maybe this helps with perf too, as they work on smaller trees |
12:55:21 | FromGitter | <alehander42> only the DOM of their panel |
13:00:47 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
13:00:49 | * | seni_ joined #nim |
13:00:52 | Araq | well it's backwards compatible except that 'n.dom' access can fail now |
13:00:58 | Araq | if you refer to an old 'n' |
13:01:07 | Araq | maybe I'll undo this change though. |
13:01:13 | Araq | it was inspired by --newruntime :P |
13:01:21 | Araq | no crazy .dom sharing |
13:02:13 | * | shomodj joined #nim |
13:08:02 | * | terps joined #nim |
13:42:32 | FromGitter | <bevo009> Can I get a strformat ninja to check this out please? ⏎ This strformat statement compiles at top level: https://play.nim-lang.org/#ix=1RSU ⏎ But the same line in a template fails: https://play.nim-lang.org/#ix=1RT1 ⏎ To work, I have to replace:' ⏎ ``` let elapsedStr = &"{elapsed:.3f}"``` ... [https://gitter.im/nim-lang/Nim?at=5d56b2c71dadc42a117fb1b2] |
13:42:54 | clyybber | Araq: WDYT about merging all nk...Expr with nk...Stmt, aside from the bootstrapping issues? |
13:53:59 | FromGitter | <bevo009> Nevermind, fixed it with {.inject.} ...https://play.nim-lang.org/#ix=1RT7 |
13:54:16 | FromGitter | <bevo009> Hope that's the right method to use |
13:55:18 | Araq | clyybber, this morning I implemented the string based nnk* comparisons in the VM |
13:55:26 | Araq | but then I stopped and considered the full situation |
13:55:49 | * | dddddd joined #nim |
13:55:55 | Araq | and rather than "fixing" the node kinds in slightly incompatible ways |
13:56:18 | Araq | I think we must stop these subtle AST changes |
13:56:57 | clyybber | Araq: Why? |
13:57:27 | Araq | IMO we need an ir.nim module that simply replaces macros.nim |
13:57:51 | clyybber | Fair enough, but that shouldn't stop us from fixing AST inconsistencies, right? |
13:58:14 | Araq | see also https://forum.nim-lang.org/t/5097 for why NimNodes are kinda bad :-) |
13:58:40 | Araq | no, that's exactly the point. don't fix "inconsistencies" |
13:58:53 | Araq | don't break somebody's macro |
14:00:54 | clyybber | Macros that rely on the disctinction between something like ElifExpr or ElifBranch are already broken anyways. |
14:01:45 | clyybber | So maybe with aliasing nnkElifExpr and nnkElifBranch to nnkElif and mergine nkElifExpr and nkElifBranch we could retain sane backwards compatability |
14:02:10 | * | terps quit (Ping timeout: 252 seconds) |
14:02:41 | Araq | "already broken anyways" well if they worked before and don't afterwards |
14:02:49 | Araq | then *we* broke them |
14:03:20 | Araq | and nnkElifBranch vs nnkElifExpr is just a tiny detail, the AST is *full* of downright undocumented node kinds |
14:05:10 | clyybber | We have tests for important packages right? And if we document in the changelog that instead of relying on the nnk...Stmt vs Expr disctinction one should check the type, I think it would be fine. |
14:06:24 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
14:06:28 | clyybber | I'm just talking about Stmt vs Expr node kinds ATM, since that distinction is IMO useless cruft, if we can just check the type instead |
14:06:41 | Araq | the important packages are incomplete and since the ast is quirky anyway, why bother |
14:08:10 | * | shomodj joined #nim |
14:08:20 | clyybber | To make life more easy? |
14:08:49 | clyybber | As in simpler macros, less weird edge cases, and (neglible) a more simple compiler |
14:10:25 | * | shomodj quit (Read error: Connection reset by peer) |
14:10:48 | * | shomodj joined #nim |
14:11:48 | * | terps joined #nim |
14:14:23 | * | PMunch quit (Remote host closed the connection) |
14:16:16 | FromDiscord_ | <Kiloneie> Could i get pros and cons of Nim thhings you like and hate the most ? I need more grounded information for the video i am working on. |
14:23:13 | * | lritter quit (Quit: Leaving) |
14:41:08 | Araq | clyybber, I'm not buying it, it's such a minor thing, we should focus on the important stuff |
14:43:16 | * | terps quit (Ping timeout: 264 seconds) |
14:44:44 | * | floppydh quit (Quit: WeeChat 2.5) |
14:47:45 | clyybber | Araq: IMO it's important too, though I agree not as important as some other stuff |
14:53:42 | FromDiscord_ | <Kiloneie> Nim runs a garbage collector by default right ? How fast is it compared to like C# one ? |
14:54:37 | Araq | much slower but it's support "realtime" and Nim is easier to optimize to avoid allocations |
14:54:55 | Araq | also with --newruntime the GC is gone |
14:57:11 | FromDiscord_ | <Kiloneie> Do all the algoritms support realtime ? on and off at a whim ? |
14:57:35 | * | terps joined #nim |
14:58:03 | Araq | what does that mean? |
14:59:04 | FromDiscord_ | <Kiloneie> Okay my bad, different algoritms, one of them is a real time one. |
14:59:20 | Araq | yup |
15:00:17 | clyybber | Araq: Should I move implicitlyDiscardable from semstmts to ast.nim ? I need it in injectdestructors |
15:02:02 | FromDiscord_ | <Kiloneie> Nim's main page does a pretty good job at introducing nim, but it does miss a few important features that are then listed in Feratures tab, and still not all of them ? A lot of digging xD. |
15:02:04 | livcd | Nim's GC is much slower compared to C# ? |
15:02:37 | Araq | livcd, depends on the workloads |
15:03:04 | Araq | allocation heavy code is usually served by a bump-pointer allocator which we don't really have |
15:04:14 | Araq | but it's pretty much universal that in most modern languages you need to optimize the number of allocations and C# doesn't make that easy |
15:04:44 | Araq | it's getting better in C# but it's not where Nim is |
15:05:02 | FromDiscord_ | <Kiloneie> C# also only has that one GC, Nim has more, or none at all. |
15:05:22 | Araq | Nim can use Go's GC btw. Never tried to use that option |
15:05:50 | FromDiscord_ | <Kiloneie> Wait, how does one turn it entirely off ? That is in the new runtime only ? |
15:07:04 | Araq | --gc:none works since forever |
15:07:17 | Araq | with --gc:none you either: |
15:07:25 | Araq | - use a restricted subset of Nim |
15:07:39 | Araq | - don't mind that only on process exit the OS frees the memory for you |
15:08:10 | FromDiscord_ | <Kiloneie> I know that sequences are GC., How do you handle that once you turn it off ? |
15:08:29 | Zevv | you dont. it just eats up and never frees |
15:08:34 | Araq | as I said, either you don't use them or you live with them leaking memory |
15:09:07 | FromDiscord_ | <Kiloneie> Does the newruntime solve that ? |
15:09:13 | Araq | yup |
15:09:32 | FromDiscord_ | <Kiloneie> Will Nim be even faster then ? |
15:09:46 | FromGitter | <erhlee-bird> what's the general usecase for --gc:stack? |
15:10:16 | Araq | kiloneie: depends on the program. |
15:10:36 | Araq | as far as we can tell from this point, usually it is faster |
15:11:42 | Araq | erhlee-bird: --gc:stack is pretty dead, --newruntime does it better |
15:11:43 | livcd | I hope for much easier parallelism story |
15:12:21 | FromDiscord_ | <Kiloneie> Okay. If i were to say Nim's standard library can be used for vast majority of programs one will write, will i be correct or very wrong ? I know it's easy to bind/wrap C libraries and that solves everything, but without that how extensive is it ?(i did read quite some on it, but i can't really tell, besides no GUI library and drawing ?) |
15:12:51 | leorize | if you don't do gui stuff, then yea, it should be fine |
15:13:20 | CcxWrk | I don't consider the async parts to be particularly ready. |
15:13:37 | FromGitter | <bevo009> https://robert-mcdermott.gitlab.io/posts/speeding-up-python-with-nim/ |
15:13:59 | CcxWrk | Other than that, it seems to cover most of the core OS API and bunch of useful data structures. |
15:15:38 | CcxWrk | bevo009: Does not even mention Cython. But nice. |
15:16:20 | Araq | Kiloneie: the stdlib has good parts but many complain about it. You can also find Nimble packages that work better than the stdlib's stuff, but that's not unique to Nim. |
15:16:35 | * | seni_ quit (Quit: Leaving) |
15:17:05 | * | terps quit (Ping timeout: 250 seconds) |
15:19:03 | FromDiscord_ | <Kiloneie> It does scream bigger community the fact that Nimble stuff works better. |
15:20:41 | Araq | somebody should take important_packages.nim and turn it into a Nim distribution |
15:21:09 | Araq | so ... any Windows experts around? |
15:21:32 | FromDiscord_ | <Kiloneie> Yeh, thats what i meant with bigger community xD... stuff like that should of been done already. Soon enough. |
15:24:00 | livcd | What windows expertise is required ? |
15:25:11 | Araq | unicode and terminals |
15:25:47 | * | terps joined #nim |
15:28:04 | Araq | I'm trying to fix https://github.com/nim-lang/Nim/issues/11618 for good but it seems impossible |
15:28:22 | Araq | not even WriteConsoleW does the trick |
15:30:40 | * | terps quit (Ping timeout: 264 seconds) |
15:31:43 | FromDiscord_ | <Kiloneie> should i say these 3 words on video : Efficient, expressive, elegant ? Or is saying that it performs on par with C whilst looking like Python better... or both ? |
15:34:14 | Araq | just say it your way |
15:34:52 | Araq | "it combines C-like speed (and by that I mean C-like, not a factor 2 slower) with Python's ease on the eyes" |
15:35:34 | FromGitter | <Varriount> Araq: What about https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar with different code pages? |
15:38:36 | FromGitter | <Varriount> Or rather, https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte |
15:39:01 | FromGitter | <Varriount> Couldn't you use WideCharToMultibyte with the current code console code page? |
15:39:29 | Araq | Varriount: ok, can try that instead. good idea |
15:39:33 | Araq | thing is |
15:40:02 | Araq | the Console now defaults to 65001 (UTF-8) |
15:40:11 | Araq | on my Win 10 machine and still nothing works |
15:40:18 | FromDiscord_ | <Kiloneie> I wrote down on par with C(performance, from what iread online it's C speed there, and a bit less in some other areas, basically C... idk.) |
15:40:53 | FromDiscord_ | <Kiloneie> It compiles so fast with such helpful tracebacks, it almost faster to write code in it than in Python lol. |
15:41:48 | FromDiscord_ | <Kiloneie> I remember using Dev-C++ at school years ago, that was real helpful when it crashed, nothing, nada. (oh wait a semicolon is missing -.-) |
15:44:39 | clyybber | Araq: What was injectdefaultcalls purpose? |
15:46:00 | clyybber | And will we ever need it in the future? |
15:46:08 | Araq | clyybber, optimization, only produce 'var x = default(T)' implicitly when the control flow analysis says we need it |
15:46:16 | Araq | I hope we can use it in the future |
15:46:22 | clyybber | Ah cool, sounds nice |
15:47:09 | livcd | i have no idea how it works but i had an issue displaying korean/chinese chars in windows cmd without doing smh explicit |
15:47:40 | Araq | livcd, for chinese you also need to select the right font |
15:47:47 | Araq | but I never got it to work either. |
15:47:55 | Araq | however, I'm testing German umlauts for now |
15:48:26 | livcd | oh |
15:50:40 | Araq | hmm echo getCurrentEncoding() says windows-1252 |
15:50:40 | shashlick | has anyone used the Intel compiler with Nim |
15:51:19 | clyybber | I suppose mratsim has at some point |
15:51:39 | FromGitter | <zacharycarter> yeah - I'm pretty sure someone has |
15:52:12 | FromGitter | <zacharycarter> I just don't know who :P |
15:52:22 | FromGitter | <Varriount> I know Demos did |
15:52:42 | FromGitter | <zacharycarter> I don't know if I want to spend time debugging HCR more, or just work on my game |
15:52:59 | FromGitter | <zacharycarter> lua so far is working for me - but working HCR would be very nice |
15:53:05 | Araq | "more"? what did you try? |
15:53:30 | FromGitter | <zacharycarter> well - I wasn't trying fixes yet - I was just trying to figure out what exactly was causing the first set of errors I was encountering |
15:54:01 | FromGitter | <zacharycarter> basically `failedAssertImpl` is not being found in the list of registered procs |
15:54:55 | FromGitter | <zacharycarter> it was a bit difficult to figure out why exactly that was happening though - because procs get registered for the module you're compiling as well as for Nim stdlib modules as well |
15:55:21 | FromGitter | <zacharycarter> and it seemed the call to register and get this proc specifically were lining up correctly |
15:55:49 | FromGitter | <zacharycarter> this definitely won't fix the reading from beyond the top of the stack issue - but I figured if I can figure out what's causing this one, then I can work on that one |
15:59:56 | FromDiscord_ | <Shield> oh wow, seqs and strings are really problematic, if you chose to ditch them, you basically can't use most if not all libs |
16:01:11 | FromGitter | <zacharycarter> why would you choose to ditch them? |
16:01:54 | disruptek | pesky strings. |
16:02:21 | FromDiscord_ | <Shield> they seem to be the source of all evil, it makes it really hard to use other gcs |
16:02:25 | disruptek | meaningless seqs. |
16:03:44 | FromGitter | <zacharycarter> which gc's? I've never heard of anyone complaining about using boehm with strings / seqs |
16:03:56 | FromGitter | <zacharycarter> gc none of course - but it's pretty obvious why that's the case |
16:04:09 | FromGitter | <zacharycarter> regions maybe? |
16:04:13 | FromDiscord_ | <Shield> I still think that a function which takes a memregion for object creation will solve a lot of stuff |
16:04:19 | FromDiscord_ | <Shield> yeah regions too |
16:04:49 | Araq | regions are viral. so everything that needs memory grows this "region" parameter |
16:05:23 | Araq | and it bubbles up for everything and in the end you use *more* memory than with alloc/dealloc |
16:05:45 | Araq | I researched these things quite a bit, you know |
16:06:06 | Araq | you're better off with destructors/deallocs |
16:07:06 | Araq | --newruntime came after --gc:regions so maybe somebody learned something from it |
16:07:30 | * | shomodj_ joined #nim |
16:07:45 | FromDiscord_ | <Shield> is it not possible to copy variables from one region to the other without some hacks? the allocator using one and only region makes any object that grows do funny things |
16:09:32 | FromDiscord_ | <Shield> doesn't newruntime still use gc for some stuff? or is it fully turned off? |
16:09:56 | FromGitter | <zacharycarter> so when compiling nimhcr with `-d:traceHcr` `get proc: C:\Users\carte\nimcache\test_d/stdlib_assertions.nim.c.dll failedAssertImpl_W9cjVocn1tjhW7p7xohJj6A` is the last line before the crash but there is no corresponding `register proc` for that proc - that's what I'm debugging atm |
16:10:15 | FromGitter | <zacharycarter> basically something is up with the codgen here |
16:10:31 | clyybber | Shield: For unowned refs it still uses refcounting. |
16:10:51 | shashlick | Araq: is it possible to use the same region across main exe and dlls? |
16:10:53 | * | shomodj quit (Ping timeout: 245 seconds) |
16:11:13 | shashlick | that might solve the multiple-gc issue right? |
16:11:20 | FromDiscord_ | <Shield> shashlick yeah you can pass it normally |
16:11:27 | FromGitter | <zacharycarter> but newruntime will do this |
16:11:33 | clyybber | Shield: Though there isn't a gc running. It's just that the destructor of an unowned ref checks the refcount before doing anything. |
16:12:14 | FromDiscord_ | <Shield> but you're really giving your region to the dll, that's a lot of trust when you can only deallocate the whole region or you don't |
16:12:33 | FromDiscord_ | <Kiloneie> How does one explain operator overloading to a mere mortal ? |
16:12:42 | FromGitter | <zacharycarter> google |
16:12:52 | shashlick | do we have any docs or examples of regions |
16:12:56 | FromGitter | <Varriount> Think of operators like procedures with fancy names? |
16:13:08 | FromGitter | <zacharycarter> there's nothing special about operator overloading - it's the same as overloading anything else |
16:13:24 | FromDiscord_ | <Shield> only the main gc is documented at all |
16:13:25 | FromGitter | <zacharycarter> key is remembering the difference b/w overloading and overriding |
16:13:29 | disruptek | first, find yourself a mortal... |
16:13:52 | FromGitter | <zacharycarter> I don't see the point of focusing on gc:regions when newRuntime will solve all of this |
16:14:22 | shashlick | regions or newruntime, without examples, i'm going to be stuck regardless |
16:14:23 | disruptek | they solve different problems. |
16:14:48 | FromGitter | <zacharycarter> I mean that they will allow what shashlick is struggling with |
16:15:03 | FromGitter | <zacharycarter> there is a lot of example code / explanations around newruntime |
16:15:06 | FromGitter | <zacharycarter> but it's still in development |
16:15:23 | FromGitter | <zacharycarter> so they may be outdated |
16:15:37 | FromGitter | <zacharycarter> newruntime is better documented than gc:regions |
16:15:49 | shashlick | if i can use regions to simply tell all the gcs to work in one area, that's just like one gc |
16:16:14 | FromDiscord_ | <Shield> region is very straight forward, just read the source code, there's a main region, and you can create more regions, you use it by having a block inside a macro to switch regions, the problem is, all allocations happen in the current region alone, god forbids you trying to pass a variable from one region to the other |
16:16:41 | FromDiscord_ | <Shield> with seq growing and reallocating, it'll jump around if you don't pay attention |
16:17:09 | FromDiscord_ | <Shield> there's also some hack in it to deal with seq internally but I never understood it |
16:17:13 | Araq | seqs growing works with regions, the seq remembers its region |
16:17:44 | shashlick | well, if it is as easy as creating a region in the main exe and passing it to the dlls, it seems like a simple fix for the near term |
16:18:27 | FromDiscord_ | <Shield> it fails when the seq is over a certain size and I don't know why, if you want to do a copy, you have to do a region within a region |
16:19:10 | FromDiscord_ | <Shield> wouldn't it be simpler to just pass the region as a parameter so the allocator never have to guess? it will give more control |
16:19:20 | * | hugogranstrom joined #nim |
16:20:05 | Araq | Shield: https://github.com/nim-lang/Nim/pull/11920 |
16:20:15 | Araq | so people are working on --gc:regions |
16:20:27 | FromDiscord_ | <Shield> tbqh after reading about newruntime multiple times I cannot understand it without proper examples |
16:20:53 | disruptek | yeah, it was leorize and Shield that instigated that patch. |
16:21:04 | disruptek | this topological superconductivity paper is insane. |
16:21:05 | Araq | oh I didn't know that :p |
16:21:12 | shashlick | okay so what should i look for in the docs to figure out regions |
16:21:53 | FromDiscord_ | <Shield> there's nothing about it in the docs |
16:22:36 | * | hugogranstrom quit (Client Quit) |
16:22:42 | FromDiscord_ | <Shield> I'll try to write an example with most features |
16:23:05 | FromGitter | <zacharycarter> where is `BModule` defined? |
16:23:20 | shashlick | thanks Shield |
16:23:33 | FromGitter | <zacharycarter> I can only see it in the JS backend |
16:23:52 | FromGitter | <zacharycarter> nm found it |
16:25:37 | * | abm quit (Quit: Leaving) |
16:26:43 | shashlick | how come devel docs doesn't show withRegion |
16:29:29 | Araq | shashlick, docs always assume --gc:refc (the default) |
16:30:13 | shashlick | this is similar to how osseps was broken then |
16:32:13 | * | Ven`` joined #nim |
16:32:58 | FromGitter | <Varriount> Araq: If you're still having problems with console encoding, you could see how mingw's printf is implemented |
16:35:25 | shashlick | One other question - is it possible to get a list of exported procs from a dll at runtime |
16:35:30 | shashlick | After dynlib |
16:35:38 | shashlick | Or some other way |
16:36:01 | Araq | Varriount: Now it's completely weird, only *some* Umlauts are rendered correctly |
16:36:54 | * | terps joined #nim |
16:37:33 | Araq | shashlick, I use "CEF explorer" for that |
16:37:46 | FromGitter | <zacharycarter> well - the reason that `failedAssertImpl` procs are not being registered with HCR is because the `isReloadable` check fails |
16:37:53 | Araq | "CFF explorer" |
16:38:02 | FromGitter | <zacharycarter> and that check is - `m.hcrOn and sfNonReloadable notin prc.flags` |
16:38:27 | Araq | why does it need to be able to "reload" this crap? |
16:38:37 | Araq | it's just assert, it doesn't change later |
16:38:46 | FromGitter | <zacharycarter> that's a good question.... |
16:38:46 | * | shomodj_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:39:18 | FromGitter | <zacharycarter> I guess because the code I'm reloading calls assert - so maybe it's because of that? |
16:39:29 | FromGitter | <zacharycarter> still doesn't make much sense though |
16:39:42 | Araq | Varriount: My string must start with an ascii char and then an umlaut may follow |
16:39:51 | Araq | then the umlaut is rendered |
16:39:59 | Araq | but not if I start the string with an umlaut |
16:40:36 | Araq | I'm beginning to think this a new Windows bug |
16:40:59 | FromGitter | <Varriount> What happens if you change your code page to a non-utf8 CP? |
16:41:12 | FromGitter | <Varriount> Or the example in the issue? |
16:41:28 | * | terps quit (Ping timeout: 264 seconds) |
16:42:45 | FromGitter | <Varriount> Any idea what the V lang implementation does? |
16:42:57 | Araq | it uses printf |
16:43:11 | Araq | but now everything works here |
16:43:20 | Araq | if I give the string an ASCII prefix |
16:43:50 | Araq | so it just works (TM) on new Windows 10 |
16:43:59 | Araq | for strings that start with "A" |
16:44:17 | Araq | good enough for me, I always wanted to start all my output with "A" |
16:44:50 | Araq | try it yourself |
16:44:52 | Araq | echo "A你好" |
16:44:53 | Araq | vs |
16:44:56 | Araq | echo "你好" |
16:45:00 | FromGitter | <Varriount> What about printf? Does printf work without the ascii character? |
16:46:36 | Zevv | maybe you should start all strings with A followed by a backspace "A\b..." |
16:47:22 | clyybber | Araq: Now make all strings start with Araq |
16:47:38 | clyybber | Nim, developer signed edition |
16:50:10 | * | terps joined #nim |
16:52:43 | disruptek | 🤣 |
16:55:13 | FromDiscord_ | <Shield> @shashlick https://play.nim-lang.org/#ix=1RU6 |
16:55:37 | FromDiscord_ | <Shield> make sure to use this pr to fix a bug, otherwise it doesn't free memory properly https://github.com/nim-lang/Nim/pull/11920 |
16:55:55 | FromGitter | <zacharycarter> so for `assertions.nim` `hcrOn` is false - I'm not sure what sets this flag per module |
16:57:04 | * | terps quit (Ping timeout: 264 seconds) |
16:57:47 | FromDiscord_ | <Shield> it's kinda tricky with seq and string, you should note that all allocations can happen in one region only, and you have to deallocate the whole region in case there's a memory leak |
16:58:21 | FromDiscord_ | <Shield> I don't think you can trust dlls with it |
16:59:13 | FromDiscord_ | <Shield> it also consumes twice the memory when you copy stuff around between regions if you're not careful |
17:00:55 | FromGitter | <zacharycarter> is @onqtam active in Nim at all anymore, or @zah ? |
17:02:25 | FromDiscord_ | <Shield> is there any clear examples for newruntime? |
17:02:35 | FromGitter | <zacharycarter> the tests I guess |
17:03:12 | FromGitter | <zacharycarter> ah - I think I know possibly why the issue is happening |
17:04:30 | FromGitter | <zacharycarter> there's a proc called `hcrOn*(conf: ConfigRef)` which checks to see if the module config global options contains `optHotCodeReloading` |
17:04:59 | FromGitter | <zacharycarter> so if assertions.nim is not compiled with - `-d:hotCodeReloading` - this check will fail |
17:05:23 | FromGitter | <zacharycarter> but the larger question you asked Araq remains - why does this need to be a registered proc to begin with? |
17:06:07 | FromDiscord_ | <Shield> are those tests available in 0.20.2? which folder? |
17:06:20 | clyybber | Shield: tests/desctrucor |
17:06:26 | clyybber | destructor |
17:06:37 | FromGitter | <zacharycarter> it's weird though - a lot of other `stdlib` modules have procs registered - so why this specific one fails... |
17:07:42 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:08:20 | * | Ven`` joined #nim |
17:08:40 | FromGitter | <alehander42> @zacharycarter zah is very active, onqtam is a bit busy probably tho |
17:08:49 | FromGitter | <alehander42> is it something about hcr? |
17:08:56 | FromGitter | <zacharycarter> mmhmm |
17:10:13 | FromGitter | <alehander42> ah, i see |
17:10:25 | * | terps joined #nim |
17:11:05 | FromGitter | <alehander42> but why is it bad that |
17:11:12 | FromGitter | <alehander42> those assertions are hcrOn |
17:11:43 | FromGitter | <zacharycarter> it's not that they're bad - it's that assertions.nim fails this check while other stdlib modules pass it |
17:12:10 | FromGitter | <zacharycarter> so the function pointer to assertImpl is never registered with the HCR table of procedures |
17:12:36 | FromGitter | <zacharycarter> and the HCR module tries to get this function pointer and that causes an error in tables.nim |
17:12:46 | FromGitter | <zacharycarter> I assume because I am using assertions in my code that is being hot reloaded |
17:13:07 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
17:13:57 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:15:34 | * | ng0 joined #nim |
17:17:22 | * | shomodj joined #nim |
17:18:23 | Araq | Shield: you compile your code with --newruntime -d:useMalloc |
17:18:42 | Araq | and it it compiles, you're good. if not you need to patch the code/stdlib... |
17:18:51 | * | terps quit (Ping timeout: 250 seconds) |
17:20:27 | Araq | Varriount: it gets ever more weirder, 'printf' works indeed |
17:22:06 | Araq | so it's 'fwrite' |
17:28:04 | FromGitter | <zacharycarter> not trying to be too controversial here - but I only see one mention of `proof of concept` in the issue about Nim HCR |
17:28:13 | FromGitter | <zacharycarter> the one that announced the grant |
17:28:20 | disruptek | always nice to pull and see nim bugs fixed; thank you. 😍 |
17:28:31 | FromGitter | <zacharycarter> but I guess it doesn't matter - what was delivered is what was delivered |
17:29:32 | Araq | so, printf works, writeConsole doesn't |
17:29:50 | Araq | what does writeConsole wrong, usually using the WinAPI directly fixes everything |
17:30:36 | * | actuallybatman joined #nim |
17:32:07 | FromGitter | <Varriount> Araq: I think (I'm not certain) that printf is calling mbtow as part of the conversion process |
17:34:24 | FromGitter | <Varriount> Lets see... printf calls pformat, which calls fputc |
17:34:34 | FromGitter | <alehander42> @zacharycarter |
17:34:48 | FromGitter | <zacharycarter> yo |
17:34:55 | FromGitter | <alehander42> so the thing is that tables.nim doesnt work with hcr/ |
17:35:04 | FromGitter | <alehander42> ?* trying to get a simple way to repro |
17:35:26 | FromGitter | <zacharycarter> I don't think it's an issue with tables.nim though |
17:35:33 | FromGitter | <zacharycarter> but that's also unfortunate it does not |
17:35:53 | FromGitter | <zacharycarter> HCR upon initialization loads a bunch of function pointers into a table |
17:36:19 | FromGitter | <zacharycarter> the error I'm facing is caused by the fact that the function pointer for `failedAssertImpl` isn't ever added to that table |
17:36:37 | FromGitter | <zacharycarter> I think maybe the reason it doesn't work with tables is because of another issue, which we might have an inkling of a clue about |
17:36:51 | FromGitter | <zacharycarter> caused by reading memory beyond the top of the stack |
17:38:04 | Araq | ah! |
17:38:18 | Araq | I cannot use writeConsole anyway since that doesn't do IO redirections |
17:39:00 | Araq | should use WriteFile |
17:39:08 | Araq | which is broken too, Jesus... |
17:39:10 | Araq | bbl |
17:42:11 | * | shashlick quit (Remote host closed the connection) |
17:42:57 | * | shashlick joined #nim |
17:43:05 | * | rayman22201 joined #nim |
17:44:12 | FromGitter | <alehander42> @zacharycarter but cant you compile assertions with hcrOn somehow |
17:44:30 | FromGitter | <zacharycarter> compilation works fine |
17:44:35 | FromGitter | <zacharycarter> runtime crash |
17:44:49 | FromGitter | <zacharycarter> oh I see what you mean |
17:44:56 | FromGitter | <zacharycarter> compile that single module with that flag - let me try that |
17:45:38 | FromGitter | <alehander42> yes |
17:46:01 | FromGitter | <alehander42> or find out why it isnt compiled with it on |
17:46:20 | * | Trustable joined #nim |
17:46:46 | FromGitter | <zacharycarter> well - that's why I'm trying to figure out but it's not straightforward |
17:46:51 | FromGitter | <zacharycarter> at least not to me |
17:46:54 | shashlick | @Shield - so if a var goes out of scope, its memory is not released till the region is freed? |
17:47:44 | rayman22201 | Not shield, but yes @shashlick |
17:48:08 | rayman22201 | Good morning all |
17:48:15 | FromGitter | <zacharycarter> o/ |
17:48:23 | FromGitter | <zacharycarter> ugh - it's almost 9PM here haha |
17:48:33 | clyybber | Same, good morning rayman |
17:48:48 | FromGitter | <zacharycarter> clyybber: where are you at? |
17:48:55 | rayman22201 | Lol. Aren't timezones fun. |
17:49:44 | FromGitter | <zacharycarter> it's still light out here though! |
17:50:18 | FromGitter | <zacharycarter> it will probably get dark around 10 |
17:51:12 | rayman22201 | It's all a lie. #flatearth :-P j/k |
17:51:46 | clyybber | zacharycarter: Germany, I just noticed its 8PM not 9 lol |
17:52:05 | FromGitter | <zacharycarter> :P I was about to say! You must be in my time zone |
17:52:07 | shashlick | well then it isn't as useful to use a region |
17:52:31 | shashlick | you cant have long running regions then |
17:52:34 | FromGitter | <zacharycarter> shashlick: we should just combine our forces and figure out HCR |
17:52:39 | FromGitter | <zacharycarter> and why it's borked |
17:53:00 | FromGitter | <zacharycarter> not sure how easy it will be though |
17:56:17 | disruptek | you know you won't have to twist shashlick's arm. 😜 |
17:56:25 | clyybber | I'll join your forces yoo |
17:56:31 | clyybber | s/yoo/too |
17:56:35 | FromGitter | <zacharycarter> force team assemble |
17:56:35 | disruptek | oh shoot! |
17:56:39 | clyybber | I have dabbled quite a bit in HCR |
17:56:48 | clyybber | seems like I didn't use asserts tho |
17:56:57 | FromGitter | <zacharycarter> I think there are a number of HCR issues |
17:57:13 | Zevv | is the feature worth the complexity? |
17:57:25 | clyybber | IMO yes |
17:57:32 | FromGitter | <zacharycarter> this is the issue I filed which I think would be a good starting point though: https://github.com/nim-lang/Nim/issues/11718 |
17:57:33 | clyybber | Because it actually isn't that complex |
17:57:51 | FromGitter | <zacharycarter> it would also be a separating feature for Nim |
17:58:13 | FromGitter | <zacharycarter> someone familiar with the compiler (aka you clyybber) would also make debugging this 100x easier I imagine |
17:58:22 | Zevv | true |
17:59:07 | FromGitter | <Varriount> I don't know - to me, HCR seems only good for certain niche features. |
17:59:10 | FromGitter | <zacharycarter> from what I've dug into so far - once asserts are no longer an issue - then there's an issue about memory being read from beyond the top of the stack |
17:59:25 | FromGitter | <zacharycarter> which Araq thought might be due to the gc having bad pointers |
18:00:02 | FromGitter | <zacharycarter> @Varriount - how many times though have people inquired about plugin systems / scripting / etc.. in Nim? |
18:00:08 | FromGitter | <zacharycarter> my guess is in the hundreds of times |
18:00:59 | Zevv | but that is not what hcr is for |
18:01:15 | Zevv | its main goal is shorten development roundtrip times |
18:01:24 | * | krux02 quit (Remote host closed the connection) |
18:01:24 | FromGitter | <zacharycarter> which is the point of the above as well |
18:01:33 | FromGitter | <zacharycarter> you write scripts so you can reload them at runtime |
18:01:38 | FromGitter | <zacharycarter> you author plugins so you can reload them at runtime |
18:01:52 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:02:00 | Zevv | yes, but that is all not hcr. you need the compiler at hand for hcr |
18:02:15 | disruptek | this. |
18:02:34 | FromGitter | <zacharycarter> you need nimhcr.dll |
18:02:38 | FromGitter | <zacharycarter> and nimrtl.dll |
18:02:49 | disruptek | where does the blob come from, though? |
18:04:06 | FromGitter | <zacharycarter> there is no live compiler with Nim HCR - if you want to understand how it was implemented: https://github.com/nim-lang/Nim/issues/8927 |
18:04:30 | disruptek | right, so with no live compiler, you have to have the compiler at hand. |
18:05:28 | Zevv | did zah implement this? and if so, is he not available to help out fixing? |
18:05:42 | FromGitter | <zacharycarter> he did not onqtam did |
18:05:47 | disruptek | i think he mentored it? |
18:05:47 | Zevv | ah ok |
18:06:39 | FromGitter | <zacharycarter> I mean - I think the point is relatively moot - you can't hot reload code in a compiled language without having a compiler |
18:06:44 | FromGitter | <zacharycarter> I'm not saying that it's apples to apples |
18:07:05 | FromGitter | <zacharycarter> I'm saying that people that want to achieve a certain architecture have another option to achieve similar results with HCR |
18:07:29 | Zevv | true. I just ment that hcr is not plugins or scripting |
18:07:46 | FromGitter | <zacharycarter> I agree - it's just it's a means to an end |
18:08:02 | FromGitter | <zacharycarter> until we get new runtime I don't think the latter are solvable |
18:08:11 | FromGitter | <zacharycarter> without major work on the GC |
18:08:56 | Zevv | makes sense. But clyybber noted hcr does not add too much complexity, and i guess he's a good authority on these matters |
18:09:21 | Zevv | so then it probably pays to keep it alive, if only for marketing purposes :) |
18:09:35 | FromGitter | <zacharycarter> well we should either kill it or fix it im |
18:09:48 | clyybber | bbl |
18:09:50 | * | clyybber quit (Quit: WeeChat 2.5) |
18:10:04 | FromGitter | <zacharycarter> having half baked features laying around doesn't do anyone any good |
18:10:28 | Zevv | is it generally broken, or only for specific cases? I only tried it once a few months ago |
18:10:41 | FromGitter | <zacharycarter> it works for simple toy examples - even the author admits that |
18:10:48 | disruptek | if it was robust, it'd be a foundation for a repl. but if not, well, then the repl is further out of reach. |
18:11:15 | FromGitter | <zacharycarter> but I started hot reloading code that called into code which used streams as well asserts |
18:11:24 | FromGitter | <zacharycarter> and I ran into all of these errors |
18:11:32 | Zevv | is it in the main docs/features or in experimental? |
18:11:57 | disruptek | hm, that's a great question. |
18:12:09 | FromGitter | <zacharycarter> https://nim-lang.org/docs/nimc.html#additional-features-hot-code-reloading |
18:12:30 | Zevv | if its not in experimental, maybe move it in there first. "half baked" is *bad* PR |
18:12:34 | disruptek | doesn't look very experimental. |
18:12:48 | * | ljoonal quit (Quit: ljoonal.xyz) |
18:13:43 | Zevv | we should make it then I guess |
18:13:57 | FromGitter | <zacharycarter> what I don't get is why the person who fulfilled the grant didn't finish it |
18:14:10 | FromGitter | <zacharycarter> when there's really no mention of just delivering a proof of concept |
18:14:21 | FromGitter | <zacharycarter> I assume he still got paid |
18:14:46 | disruptek | the docs were probably part of the PR and weren't, uh, made more modest by the author. |
18:14:48 | FromGitter | <zacharycarter> maybe because it was deemed impossible? |
18:15:04 | FromGitter | <zacharycarter> and he only did what was possible? |
18:15:26 | FromGitter | <zacharycarter> but I don't really buy that since people implement hot reloading in C all the time |
18:15:46 | FromGitter | <zacharycarter> probably because it was a time constrained effort and he did what he could in the time allotted |
18:15:56 | FromGitter | <zacharycarter> and then it's just sat there since |
18:16:47 | * | ljoonal joined #nim |
18:17:06 | * | fredrik92 joined #nim |
18:19:59 | shashlick | hcr still depends on nimrtl which didn't do any better across dlls for me since i use threads |
18:23:34 | FromGitter | <alehander42> yes, afaik improving nimrtl is one of the main things, which is not really part of hcr |
18:24:07 | FromGitter | <zacharycarter> well that's been a thing for a while I believe |
18:24:27 | FromGitter | <zacharycarter> improving nimrtl - and it's not happened |
18:24:41 | FromGitter | <zacharycarter> there are issues about nimrtl and reloading dlls dating back several years |
18:24:53 | FromGitter | <alehander42> well yeah, but my point is, that most of the purely hcr stuff must be there |
18:25:04 | FromGitter | <alehander42> even if not stable enough |
18:25:14 | FromGitter | <zacharycarter> it could be |
18:26:23 | FromGitter | <zacharycarter> I mean it probably is since hcr depends on rtl |
18:27:02 | FromGitter | <zacharycarter> but I don't think the hcr failures I've run into are caused by rtl |
18:27:35 | disruptek | maybe it wouldn't be too hard to run tests on the hcr using the existing testsuite. |
18:29:47 | rayman22201 | I think Nimrtl hasn't been a priority for the same reason regions and the other GC's haven't been a priority. Araq thinks newruntime will supercede them. |
18:31:50 | rayman22201 | At least that's my understanding. (Not to put words in his mouth) |
18:36:53 | Zevv | there's a lot of things that will magically be fixed with the newruntime, if i undestand correctly :) |
18:39:27 | rayman22201 | Lol. It may be too hyped. We'll see. |
18:39:56 | * | nif quit (Quit: ...) |
18:40:05 | * | nif joined #nim |
18:40:12 | rayman22201 | At least it's not as bad as Vlang :-P |
18:40:21 | Zevv | its hard to get a feeling about how finished it is. nearing 90%? only half? |
18:41:01 | rayman22201 | I think only Clyybber and Araq know the answer to that question. |
18:41:33 | Zevv | i hope so :) |
18:44:09 | FromGitter | <zacharycarter> Meh - Nim + Lua seems to be working well for my project so I don't think I'll try to deviate for now |
18:45:02 | FromGitter | <zacharycarter> and it's worlds better than C++ or C with Lua |
18:45:37 | disruptek | is it? why is that? |
18:46:09 | FromGitter | <zacharycarter> I don't have to manage memory |
18:46:20 | FromGitter | <zacharycarter> unless I want to |
18:46:22 | disruptek | oh, right. |
18:46:58 | FromGitter | <zacharycarter> also - the stdlib |
18:49:40 | shashlick | regions doesn't seem to release memory back to the OS even after deallocAll() |
18:50:32 | Zevv | what lies below regions? malloc or mmap? |
18:50:33 | disruptek | what's the status of quickjs on nim? is that wrapper shashlick wrote working well? i don't recall hearing much about it since it was created. |
18:51:01 | disruptek | shashlick: i think the recent issue explains the expected behavior best. |
18:51:11 | rayman22201 | @shashlick: that's the bug that was fixed in shields PR. You need that PR |
18:53:38 | rayman22201 | https://github.com/nim-lang/Nim/pull/11920 |
18:58:34 | shashlick | @rayman22201 - the PR suggests it only fixes an issue with scratch region deallocation |
18:59:07 | shashlick | @disruptek - not sure if it was really used or not, i just created it |
18:59:18 | shashlick | like the ultrajson wrapper a couple days ago |
18:59:31 | shashlick | https://pastebin.com/rPjGFHVD |
19:00:55 | rayman22201 | iirc the PR fixed something to do with deallocAll as well |
19:01:02 | FromDiscord_ | <treeform> I found it odd that there is no `nim --os:ios` is nim not supported on iOS? |
19:01:26 | FromDiscord_ | <treeform> I also found it funny that `nim --os:android` makes it work on iOS (probably due to openGL ES) |
19:01:40 | disruptek | treeform: it's too hard to determine the platform difference between macos and ios. |
19:02:31 | FromDiscord_ | <treeform> I tried `macos` and `macosx` but that did not compile right. Its funny that `android` is closer to iOS than `macos` is. |
19:03:15 | rayman22201 | I just think nobody has tried to compile Nim on iOS before, so it never came up. |
19:03:36 | shashlick | macos is old mac, macosx is newer mac |
19:03:36 | disruptek | nah, there's some `when ios` stuff in the codebase in a couple places. |
19:03:38 | FromDiscord_ | <treeform> this guy did: https://github.com/yglukhov/nimx |
19:03:59 | Zevv | rayman22201: yes, but does it make sense to replace the threadpool given mratsims new Picasso initiative |
19:04:37 | rayman22201 | @Zevv what context? Oh the GitHub comment! |
19:05:33 | rayman22201 | Oh. Yes. It still makes sense. Mratsims RFC is very much a 2.0 long term goal. We really need a better threadpool for 1.0. short term solution. |
19:06:06 | FromDiscord_ | <Shield> shashlick no it fixes withRegion too, basically all what those macros do is do a swap with tlRegion (the default region) then swap back, the problem that the swapping back was missing, MemRegion isn't a ref, so the deallocation does not happen correctly |
19:06:10 | * | nif quit (Quit: ...) |
19:06:19 | * | nif joined #nim |
19:06:29 | Zevv | rayman22201: make sense. but then agian, we can fix #2 on the old threadpool as well |
19:06:46 | Zevv | because replacing that will also be a project with tons of politics |
19:06:47 | FromDiscord_ | <Shield> regions are basically memory pools, at least seq and strings are usable, once you go to gc:none, you are on your own to implement everything |
19:07:59 | FromDiscord_ | <Shield> allocshared for regions is the same as allocation, I dunno how it'll work across threads |
19:08:12 | rayman22201 | @Zevv: of course. I didn't mean to imply an order. We can fix #2 independently. |
19:08:15 | FromDiscord_ | <Shield> I guess you have to use locks |
19:08:37 | shashlick | @Shield - even with the PR it doesn't really release mem back to the OS |
19:09:29 | FromDiscord_ | <Shield> try with -d:useMalloc |
19:09:51 | shashlick | https://play.nim-lang.org/#ix=1RVv |
19:09:53 | rayman22201 | @Zevv although, I think replacing threadpool will be much less politics. Especially since we have a good long term plan with mratsims RFC. |
19:09:55 | shashlick | i did and it didn't help |
19:10:02 | FromDiscord_ | <Shield> I just did a manual fix for my nim folder, but the pr should be correct, it works on my end |
19:10:49 | shashlick | how do i check actual mem usage |
19:11:00 | Zevv | rayman22201: but will it break current code, or is it 100% api compatible? |
19:11:12 | FromDiscord_ | <Shield> I posted the procs in the end of the examples, same as normal gc |
19:11:19 | Zevv | if stuff will break, there will be politics |
19:11:22 | FromDiscord_ | <Shield> and you're using withRegion, not withScratchRegion |
19:11:32 | FromDiscord_ | <Shield> you didn't do any deallocation |
19:11:40 | FromDiscord_ | <Shield> add m.deallocAll() |
19:11:40 | shashlick | i want to reuse the region from start to finish |
19:11:54 | FromDiscord_ | <Shield> yeah, add that before or after sleep |
19:11:56 | shashlick | basically using 1 region across gcs |
19:12:12 | shashlick | why isn't it reusing the mem from the vars that are no longer in scope |
19:12:34 | FromDiscord_ | <Shield> like I said, it's manual memory management but with pages of memory instead |
19:12:45 | FromDiscord_ | <Shield> you have to deallocate yourself |
19:12:57 | shashlick | so it's effectively like --gc:none |
19:13:03 | shashlick | keep using ram until you dealloc |
19:13:13 | shashlick | doesn't care that vars are no longer in scope and referred to |
19:14:18 | shashlick | so the `var istr` is used and thrown away so that mem should get returned to the region as unused |
19:14:27 | FromDiscord_ | <Shield> yes, you use it if you want to isolate variables and ensure that they actually stay alive, you can have the dll have it's own region that gets freed when it's unloaded |
19:14:32 | shashlick | but it just keeps using new memory, even in subsequent iterations |
19:15:09 | shashlick | my use case is a long running text editor, the main exe and dlls are loaded until app exit |
19:15:27 | shashlick | there's no unloading |
19:16:21 | disruptek | shashlick: are you using the patched version? |
19:17:28 | shashlick | yes |
19:17:34 | shashlick | did you try my snippet |
19:17:44 | disruptek | where is it? |
19:17:47 | shashlick | see RAM usage in procexp (Windows) |
19:17:53 | shashlick | https://play.nim-lang.org/#ix=1RVv |
19:19:13 | shashlick | i think even with regular GC, using a var in a for loop, Nim doesn't really clean up |
19:19:31 | shashlick | perhaps i add a GC_fullCollect |
19:20:49 | shashlick | nope, doesn't make a difference |
19:21:15 | shashlick | it's one thing not to return to the OS, it's another thing to use more and more RAM that should have been recovered from the previous for loops |
19:21:17 | disruptek | hmm. |
19:22:13 | disruptek | is the patch merged? |
19:22:53 | disruptek | because mine is growing, too. i thought the region would be deallocated outside its block |
19:23:15 | disruptek | maybe defer m.dealloc... in the block? |
19:23:22 | shashlick | well you need to call deallocAll() to deallocate a region |
19:23:47 | shashlick | but i'm just asking for vars that go out of scope to release their mem back to Nim at least so it can be reused |
19:24:05 | shashlick | so in 3 for loops, it should use only 1 chunk of mem, not 3 |
19:24:16 | FromGitter | <Varriount> Araq: https://stackoverflow.com/questions/10882277/properly-print-utf8-characters-in-windows-console |
19:24:25 | FromGitter | <Varriount> That may or may not help |
19:25:17 | FromDiscord_ | <Shield> shashlick the patch is not merged |
19:25:27 | FromDiscord_ | <Shield> you need to edit gcregions.nim yourself |
19:25:32 | rayman22201 | @Zevv: Yuri's threadpool looks api compatible on the surface. I have not tested it in depth. There is probably some work to be done here. |
19:26:04 | shashlick | i did edit it |
19:26:05 | FromDiscord_ | <Shield> also your i*i*i was causing an overflow, I stared at the screen for a good minute figuring out why that simple program crashed |
19:26:16 | FromDiscord_ | <Shield> i x i x i |
19:26:28 | FromDiscord_ | <Shield> also you're using echo 9999 times 3 times |
19:27:10 | rayman22201 | @Zevv The good news is that I don't think threadpool is nearly as popular as async, so less people to complain about behavior changes :-P and we have the test suite + important packages to verify. |
19:27:45 | shashlick | i took the changes in withRegion() |
19:28:39 | disruptek | turning off echo (in unpatched nim) causes it to use less memory, too. |
19:29:04 | shashlick | it shouldn't use more ram in 2nd and 3rd loop |
19:29:09 | FromDiscord_ | <Shield> https://play.nim-lang.org/#ix=1RVB |
19:29:42 | Araq | Varriount: I read that too, I'm close to giving up and will call 'printf' |
19:30:01 | FromDiscord_ | <Shield> it frees memory correctly, but do note some stuff, echo, $ and any string concat causes garbage, it will pollute your current memory too |
19:30:19 | shashlick | well, i don't want to deallocate until program exit |
19:30:28 | Araq | for these the "scratch region" works well enough |
19:31:15 | Zevv | rayman22201: well, we could just make a pr pulling it in and see what happens. I lack the background knowledge to provide a rationale *why* we do that, though |
19:31:18 | FromDiscord_ | <Shield> yes, you basically have to use multiple regions, the main one the should be perfectly controlled, and other ones you use to keep garbage out |
19:31:41 | FromDiscord_ | <Shield> that* |
19:31:45 | Zevv | rayman22201: is "because araq said so" good enough? |
19:31:47 | shashlick | well, point is that old unused memory isn't getting recovered |
19:31:52 | shashlick | so it is like --gc:none |
19:32:31 | FromDiscord_ | <Shield> it is, but less harsher and you can use seq with it |
19:32:49 | rayman22201 | @Zevv: I think so. we can also point to the irc logs for more context if needed. |
19:33:47 | FromDiscord_ | <Shield> it also means that you should know what you're doing and how you're doing it, a text editor processing strings will generate garbage, any network handling generates garbage, there are a lot of string copy under the hood |
19:34:08 | FromDiscord_ | <Shield> even a temp var can be troublesome |
19:34:35 | FromDiscord_ | <Shield> OTOH, any bug is on you, you can't get any more personal with memory management |
19:36:16 | rayman22201 | @Zevv I also know for a fact that Yuri's threadpool fixes some bugs that I have opened. This one for example: https://github.com/nim-lang/Nim/issues/11717 |
19:36:20 | shashlick | ya, regular GC reuses memory |
19:36:34 | shashlick | if the region doesn't reuse memory, it is pointless |
19:36:38 | shashlick | you cannot use it for longer running stuff |
19:37:04 | Zevv | rayman22201: well, go for it I guess. one step at a time, someone should do it right? |
19:37:38 | shashlick | i'd have expected regions to effectively be the same algorithm as the refc gc |
19:37:47 | rayman22201 | @Zevv It's on my to-do list :-) |
19:37:57 | shashlick | if a var went out of scope, you shouldn't have to wait until dealloc |
19:38:01 | Zevv | first let me finish my holidays :) |
19:38:28 | rayman22201 | Lol. Yes! Go enjoy yourself! |
19:38:54 | Zevv | dont worry, doing just that |
19:42:29 | shashlick | @Araq - any reason why --gc:regions doesn't reuse memory of out of scope vars? forces it to be used only for short durations |
19:42:41 | * | Ven`` joined #nim |
19:43:02 | shashlick | in fact i wonder what the default region does - all that ram won't be released at all until program exit |
19:43:35 | FromDiscord_ | <Shield> something has to give, gc doesn't reuse memory fast enough, I can max out my system memory with repeated memory allocations in loops |
19:43:57 | shashlick | but even if you call GC_fullCollect doesn't do anything |
19:43:58 | FromDiscord_ | <Shield> and as Araq said, if you want things to leave memory when they go out of scoop, you use withScratchRegion |
19:44:18 | FromDiscord_ | <Shield> regions doesn't have gc_fullcollect |
19:44:21 | shashlick | well you are still stuck with the main region which will do the same thing |
19:44:39 | shashlick | anything long running won't be able to use regions |
19:45:13 | FromDiscord_ | <Shield> I don't think you understood the principle of regions |
19:45:35 | FromDiscord_ | <Shield> you have a region for things that will last for the whole execution, then you make other regions for temporary stuff |
19:45:58 | FromDiscord_ | <Shield> and use withScratchRegion for quick and dirty |
19:46:35 | FromDiscord_ | <Shield> you won't run out of memory if you know where you're allocating |
19:47:47 | shashlick | i get the scratch regions, but requiring scratch for every random temporary vars is excessive |
19:48:05 | shashlick | my snippet is a bad example |
19:50:21 | shashlick | i get the idea but not providing a way to clean up (automated or manual) without full destruction makes it very limited |
19:50:48 | FromDiscord_ | <Shield> it is no different than using manual allocation, but less ugly, but I see what you're getting at, the problem is regions cannot handle holes, it will keep allocating memory at the end until you purge the whole region |
19:53:13 | shashlick | i'd have thought it would be easier to use the standard gc behavior but just have multiple "spaces" to work within and throw out |
19:54:18 | shashlick | i cannot think of any use case where regions will not prove to be a big pain |
19:54:42 | shashlick | anyway, it doesn't solve my problem so back to the drawing board |
19:57:27 | rayman22201 | At the risk of being annoying, may I suggest newruntime? |
19:58:54 | shashlick | again, need some examples to look at 😄 |
20:01:31 | FromDiscord_ | <Shield> I'm looking at the tests |
20:02:44 | * | krux02 joined #nim |
20:02:46 | * | rockcavera quit (Remote host closed the connection) |
20:15:45 | Araq | Shield: regions are inherently less flexible than a real heap is |
20:15:51 | Araq | and that matters for UI apps |
20:27:47 | FromDiscord_ | <Shield> I see, it looked like the better option instead of using gc:none, using minimal nim is counter productive |
20:32:34 | FromGitter | <deech> The `c2nim` docs are down: https://nim-lang.org/docs/c2nim.html. |
20:33:38 | dom96 | hello everyone, how's everyone doing? |
20:35:12 | Zevv | should we *all* answer? |
20:37:29 | Araq | deech: https://nim-lang.org/docs/tools.html doesn't link to that anymore |
20:37:57 | dom96 | Zevv, why not? :P |
20:38:57 | shashlick | i feel like a rat stuck in a cage running around in circles with nowhere to go |
20:39:41 | dom96 | ahh, so not great. Should I be concerned for your well being? |
20:41:47 | Araq | shashlick: I've looked at your DLL bug report |
20:42:14 | Araq | but you write "it works if put in a main proc" so that cannot be the real problem, can it? |
20:42:27 | Araq | putting stuff in a main proc is a valid workaround |
20:49:07 | shashlick | no i'm cool, just frustrated |
20:49:25 | Araq | shashlick: saw my question? |
20:50:31 | * | narimiran quit (Remote host closed the connection) |
20:50:51 | shashlick | ya, but that's just a minimal example - i run into the issue in my code which isn't isMainModule |
20:51:12 | shashlick | further, i worked around it by changing the HashSet to a seq |
20:51:23 | shashlick | i run into a similar assert in another way though |
20:52:27 | shashlick | but i suspect that is because of multi-gc |
20:53:55 | Araq | shashlick: hmm ok, so you think your minimal example is also what makes it fail for feud? |
20:56:56 | shashlick | i suspect there's something funky going on with dll loading causing asserts |
20:57:22 | shashlick | if you know it is because of multiple gcs, then i can only use newruntime or alloc0() |
20:57:52 | shashlick | alloc0 will be a pain to use to interop between main exe and dll |
20:58:11 | * | Trustable quit (Remote host closed the connection) |
21:00:06 | shashlick | here's my data structure - https://github.com/genotrance/feud/blob/master/src/globals.nim#L14 |
21:00:07 | * | theelous3 joined #nim |
21:00:20 | shashlick | i use cindex for the plugin dll to tell me what procs are exported |
21:00:35 | shashlick | i get that info in onLoad() and then symAddr() all of them |
21:00:44 | * | Kaivo quit (Quit: WeeChat 2.5) |
21:00:46 | shashlick | they are stored into callbacks |
21:01:29 | shashlick | so what's happening is that cindex comes from the dll and stored into Plugin which is allocated in the main exe |
21:01:43 | shashlick | i see most mixups in the callbacks table |
21:01:55 | shashlick | stuff disappears or random stuff shows up in it |
21:04:46 | shashlick | in some sense, i'm trying stuff that isn't supported/tested |
21:04:53 | shashlick | i am exchanging data across exe and dll while using threads so nimrtl doesn't work |
21:05:22 | shashlick | boehm used to work in 0.19.6 but doesn't anymore, so we could debug that but it seems like a distraction from newruntime |
21:06:07 | shashlick | I think https://github.com/nim-lang/Nim/issues/11914 might be a better use of your time |
21:14:07 | FromDiscord_ | <Shield> https://github.com/nim-lang/Nim/issues/11914 |
21:14:22 | FromDiscord_ | <Shield> oh I posted before finishing reading |
21:14:33 | FromDiscord_ | <Shield> I wonder what is wrong in hashsets |
21:14:56 | FromDiscord_ | <Shield> can somebody explain how memory works between the main exe and dlls? |
21:19:55 | FromGitter | <Varriount> What do you mean? |
21:23:23 | * | nif quit (Quit: ...) |
21:23:33 | * | nif joined #nim |
21:27:54 | FromDiscord_ | <Shield> I don't understand why there should be one gc instance per address space, why wouldn't gcref/unref help with memory across dlls? |
21:28:37 | rayman22201 | A dll loads into the main exes memory space just like C. But the problem is that for Nim the dll doesn't know about the main exes gc, and may try to init it's own GC. This causes all kinds of problems. Nimrtl is supposed to solve this by having a common GC api that everything uses. |
21:29:33 | shashlick | see my link further up to globals.nim and how cindex and callbacks are working |
21:29:50 | shashlick | since it is two GCs, they cause issues |
21:31:36 | rayman22201 | Both GCs assume they are the only GC and that they control the entire heap. So they interfere with each other. The GC algorithms aren't designed to compose with multiple instances running. |
21:32:58 | * | solitudesf quit (Ping timeout: 245 seconds) |
21:33:39 | shashlick | is the heap at the same spot in memory or do the two GCs look at different mem locations |
21:34:04 | shashlick | if it is the same then even if I don't copy data back and forth and use alloc, i might have the GCs still mix up unshared data |
21:34:07 | shashlick | and cause other issues |
21:38:42 | rayman22201 | https://github.com/nim-lang/Nim/blob/devel/lib/system/gc.nim#L99 |
21:38:56 | rayman22201 | probably two different locations based on this, but they will run into each other eventually |
21:42:58 | shashlick | so using alloc() to interact between main exe and dll isn't fool proof either |
21:43:05 | shashlick | with multiple GCs, i'm asking for trouble |
21:43:39 | FromDiscord_ | <Shield> well, Araq did suggest using normal gc without nimrtl and see how it goes |
21:43:53 | Araq | I didn't |
21:44:12 | Araq | you need the GC to be in nimrtl so that every DLL can share the heap |
21:44:37 | Araq | that's not a problem unique to GCs, but to every allocator, C has the same problem, it's just hidden better |
21:51:02 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:00:20 | shashlick | so with nimrtl, I get this - http://ix.io/1RWl |
22:01:56 | FromDiscord_ | <Shield> why so many threads? |
22:02:57 | * | fredrik92 quit (Ping timeout: 245 seconds) |
22:03:13 | shashlick | there should just be 2, i don't know why there's so many cause it hasn't loaded anything |
22:03:20 | shashlick | main thread and monitor thread that loads dlls |
22:07:44 | shashlick | so in summary, cannot use nimrtl (threads), regions (long running), alloc (still multiple GCs which could cause other havoc) |
22:08:21 | shashlick | i can continue to debug with boehm |
22:08:38 | shashlick | newruntime also doesn't seem practical since i use tables a lot |
22:09:21 | shashlick | i have low confidence i'll make any progress with boehm since i've already spent several weeks on that |
22:09:55 | disruptek | feelsbadman |
22:12:56 | rayman22201 | You might be able to debug nimrtl. Based on the stack trace you posted, It looks like it gets a bad pointer here : https://github.com/nim-lang/Nim/blob/devel/lib/system/threads.nim#L165 |
22:14:40 | rayman22201 | Wrong version. This link: https://github.com/nim-lang/Nim/blob/v0.20.2/lib/system/threads.nim#L165 |
22:16:18 | FromDiscord_ | <Shield> did you try gc:go? |
22:16:23 | FromDiscord_ | <Shield> why wouldn't alloc work? |
22:16:42 | FromDiscord_ | <Shield> with pointers I mean, not refs |
22:17:05 | shashlick | i rebuilt nimrtl.dll with debug info to get a better stack trace |
22:17:12 | shashlick | and now it loaded! |
22:17:24 | shashlick | everything else was built with debug, perhaps that makes a difference? |
22:18:10 | shashlick | gosh was it just that? |
22:18:29 | FromDiscord_ | <Shield> in the docs it tells you that using nimrtl with threads:on is untested, but then again it's compiled with that flag by default |
22:19:12 | FromDiscord_ | <Shield> try everything with release build and see |
22:23:09 | shashlick | cool, anyway, need to test everything, will report back |
22:24:41 | FromGitter | <deech> Araq, thanks! |
22:26:19 | FromGitter | <deech> Is there a way to generate entire modules? I want to sequester a bunch of generated code into a named module not have it pollute the current namespace with `{.dirty.}`. |
22:39:16 | * | actuallybatman quit (Ping timeout: 246 seconds) |
22:41:08 | FromDiscord_ | <Shield> I still don't fully understand "owned", does that mean it's guaranteed to be consumed and owned by one owner? |
22:41:17 | FromDiscord_ | <Shield> what happen if you just discard it? |
22:54:50 | shashlick | nope - release mode crashes just the same (release feud + release nimrtl crashes), (debug feud + release nimrtl crashes), (debug feud + debug nimrtl worked but doesn't anymore!?) |
22:57:06 | shashlick | here's a better stack trace http://ix.io/1RWB |
23:10:24 | * | krux02_ joined #nim |
23:11:02 | rayman22201 | That stack trace is interesting. How does it get from gc_common.nim:284 to system/threads.nim:152? That makes no sense. gc_common.nim:284 is just a null check? https://github.com/nim-lang/Nim/blob/v0.20.2/lib/system/gc_common.nim#L284 |
23:11:09 | shashlick | makes no sense ya |
23:11:28 | shashlick | well the bigger thing is line 272 |
23:11:41 | shashlick | i am setting -d:useNimRtl - why is it still going in there |
23:12:18 | rayman22201 | After that, threadProcWrapStackFrame is calling threadProcWrapperBody, which calls threadProcWrapStackFrame again. So it looks like it is trying to wrap the thread stackFrame twice. |
23:13:16 | * | krux02 quit (Ping timeout: 264 seconds) |
23:13:55 | rayman22201 | ohhhh. I see what you mean about 272. interesting. Stupid question, but are you setting -d:useNimRtl when building both Feud and nimrtl? |
23:14:06 | shashlick | i am when building feud and all dlls |
23:14:17 | shashlick | but you cannot set -d:useNimRtl for building nimrtl due to this |
23:14:25 | shashlick | https://github.com/nim-lang/Nim/blob/v0.20.2/lib/system/inclrtl.nim#L22 |
23:14:45 | shashlick | maybe line 152 is wrong and should be commented out? or changed to something else |
23:14:49 | rayman22201 | ahhh. That makes sense lol |
23:15:29 | shashlick | line 152 in threads.nim that is |
23:15:45 | rayman22201 | Well, nimGC_setStackBottom must exist |
23:15:51 | rayman22201 | it's an important proc |
23:16:22 | * | clyybber joined #nim |
23:17:59 | rayman22201 | It's like this stack trace is out of order. It's kind of bizarre |
23:18:20 | shashlick | well, so i think nimrtl.dll is running that code |
23:18:40 | shashlick | and it is weird that docs say threads are not supported or tested but the .cfg has --threads:on |
23:19:59 | rayman22201 | ah. duh. gch.stack.bottom is the segfault. |
23:20:23 | rayman22201 | ok, looks like you have gdb. can you print the value of `gch` at the time of the crash? |
23:23:41 | rayman22201 | what does `{.rtlThreadVar.}` do? I assume it's some special version of `{.threadVar.}` |
23:25:53 | shashlick | ugh no symbol in current context |
23:25:55 | shashlick | for gch |
23:26:36 | FromDiscord_ | <Shield> rtlThreadVar means threadVar when thread support is on and means nothing when it's off |
23:26:47 | shashlick | {.pragma: rtlThreadVar, threadvar.} |
23:26:57 | rayman22201 | my hunch is that `gch` is a thread local variable, and you are starting a new thread, so `gch` doesn't exist for that thread |
23:27:39 | rayman22201 | @Shield thanks! |
23:28:22 | * | stefanos82 quit (Quit: Quitting for now...) |
23:28:37 | rayman22201 | I wonder if the bug is this stupid. Try switching lines 152 and 153 in threads.nim |
23:28:40 | rayman22201 | https://github.com/nim-lang/Nim/blob/v0.20.2/lib/system/threads.nim#L152 |
23:30:16 | rayman22201 | I actually don't understand how it makes sense to call `nimGC_setStackBottom` on a `gch` that may not exist yet |
23:30:35 | shashlick | see line 182 in gc_common |
23:30:37 | shashlick | same order |
23:32:03 | rayman22201 | weird |
23:32:22 | rayman22201 | well, somehow the `gch` struct is getting borked. |
23:32:28 | * | vesper11 quit (Ping timeout: 246 seconds) |
23:33:20 | * | ng0 quit (Ping timeout: 260 seconds) |
23:34:01 | rayman22201 | bah. I have to go. bbl |
23:34:33 | shashlick | no problem thanks for taking a look |
23:38:07 | clyybber | gn8 |
23:38:08 | * | clyybber quit (Quit: WeeChat 2.5) |
23:43:06 | * | ng0 joined #nim |
23:47:10 | FromDiscord_ | <Shield> did that solve it? what's about bohem that makes it work? |
23:47:45 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
23:48:32 | shashlick | nope i'm still stuck - trying nimrtl and have crash issues due to threads |
23:48:57 | shashlick | boehm is aware of cross thread data so no multi-gc issues |
23:49:09 | shashlick | but it no longer works on 0.20.x for some reason |
23:49:31 | shashlick | and there's no real support for boehm in the community |
23:51:52 | FromDiscord_ | <Shield> can you test go? |
23:52:28 | * | abm joined #nim |
23:52:49 | shashlick | how will it help? |
23:53:12 | shashlick | and what do i need to get it running besides --gc:go |
23:57:01 | FromDiscord_ | <Shield> you grab the go dll just like bohem |
23:57:31 | FromDiscord_ | <Shield> I'm curious if it'll have less bugs |
23:57:56 | shashlick | I'm building |
23:58:03 | shashlick | But still searching the dll |
23:58:08 | shashlick | Need 64 bit |