<< 16-05-2018 >>

00:13:37*jnhevqjjiupv quit (Quit: WeeChat 2.1)
00:20:13FromGitter<data-man> After reviewing the sources, I correct my answer: CountTable keep keys with zero values but don't yields them in an iterators. ⏎ I think that's wrong. Maybe will be better to add the parameter like ```ignoreZeroVals```.
00:24:05*athenot_ quit (Ping timeout: 276 seconds)
00:32:57*cspar quit (Ping timeout: 240 seconds)
01:09:40*rauss quit (Read error: Connection reset by peer)
01:11:50*rauss joined #nim
01:28:30*gokr quit (Ping timeout: 268 seconds)
01:41:34*vivus quit (Quit: Leaving)
02:12:38*crem quit (Ping timeout: 276 seconds)
02:13:33*crem joined #nim
02:41:31*skrylar joined #nim
03:03:45*rockcavera quit (Read error: Connection reset by peer)
03:04:02*rockcavera joined #nim
03:04:02*rockcavera quit (Changing host)
03:04:02*rockcavera joined #nim
03:35:24*dddddd quit (Remote host closed the connection)
04:16:37*FuntDobra__ joined #nim
04:24:01*CodeVance quit (Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org)
04:35:14*leorize quit (Ping timeout: 260 seconds)
04:41:12*miran joined #nim
04:43:35*FuntDobra__ quit (Ping timeout: 240 seconds)
04:57:33*CodeVance joined #nim
05:09:48*leorize joined #nim
05:25:41*olleh joined #nim
05:27:57*miran quit (Ping timeout: 264 seconds)
05:34:34*nsf joined #nim
05:44:23*darithorn quit (Remote host closed the connection)
05:57:04*leorize quit (Ping timeout: 256 seconds)
06:09:02*leorize joined #nim
06:20:57*nsf quit (Ping timeout: 240 seconds)
06:26:01*Vladar joined #nim
06:50:11*Ven`` joined #nim
06:51:56*nsf joined #nim
06:55:09ollehguys, is it possible to convert an object to json?
06:55:10*FuntDobra__ joined #nim
06:55:17ollehnot manually
06:55:40ollehlooking for a toJson method that takes objects
06:56:10*FuntDobra__ quit (Remote host closed the connection)
06:56:32*FuntDobra__ joined #nim
06:58:36*FuntDobra_ joined #nim
06:58:36*FuntDobra__ quit (Read error: Connection reset by peer)
06:59:21FromGitter<abijahm> @olleh https://nim-lang.org/docs/json.html#to.m,JsonNode,typedesc
07:00:03*FuntDobra__ joined #nim
07:00:31ollehlooking for the exact opposite
07:00:34ollehfrom data to json
07:00:44FromGitter<abijahm> this https://nim-lang.org/docs/json.html#%*.m,untyped
07:00:55ollehlol
07:02:05ollehtu
07:02:06ollehty
07:02:49ollehabijahm, do you have any idea why the method is called %* and not 'from' ?
07:03:11*FuntDobra_ quit (Ping timeout: 276 seconds)
07:03:29ollehactually, it's not a method..
07:04:46*PMunch joined #nim
07:09:45FromGitter<abijahm> @olleh yah its a macro,its discussed here https://github.com/nim-lang/Nim/pull/1869
07:25:34*nsf quit (Ping timeout: 260 seconds)
07:26:56*Ven`` quit (Read error: Connection reset by peer)
07:27:04*Ven`` joined #nim
07:28:02*Ven`` quit (Read error: No route to host)
07:28:27*Ven`` joined #nim
07:29:57*FuntDobra__ quit (Ping timeout: 240 seconds)
07:32:34*beatmox quit (Remote host closed the connection)
07:38:02*nsf joined #nim
07:40:40*FuntDobra__ joined #nim
07:44:09*gokr joined #nim
07:46:33*nsf quit (Ping timeout: 264 seconds)
07:59:30*noonien joined #nim
07:59:56*floppydh joined #nim
08:00:16*skrylar_ joined #nim
08:01:13*olleh quit (Quit: Leaving)
08:03:07*skrylar quit (Ping timeout: 256 seconds)
08:04:15*gmpreussner quit (Ping timeout: 256 seconds)
08:05:07*gmpreussner joined #nim
08:14:08*FuntDobra_ joined #nim
08:15:06TangerHey folks, how would I go about limiting the amount of memory an object can take? Would I have to get pretty low level or are there high level things that can do the trick. My example is making a paging table with rows of data, I obviously don't want a row being split over two pages
08:15:45PMunchWell, all objects are limited in their size..
08:16:33*FuntDobra__ quit (Ping timeout: 248 seconds)
08:17:15PMunchWhat kind of object are you working with?
08:17:25PMunchAnd how are you aligning to pages?
08:18:21TangerPMunch: Let's say a Row consists of a string and 2 uint32. I'm thinking that I can't just limit a string defined on a Row type to just X bytes, right?
08:19:03TangerAnd my paging table would theoretically hold X Rows per table
08:19:11PMunchWell, a string in Nim is a size integer and a pointer to the string data
08:19:40PMunchYou could use an array, which is of static length
08:19:48*sendell joined #nim
08:20:25TangerReally? Can you actually access the size integer and stuff?
08:20:46PMunchWell, you access it by calling "hello".len
08:20:59PMunchThe len proc just looks up the length of the string
08:21:03TangerHaha, makes sense
08:21:08PMunchIt doesn't actually calculate it :P
08:21:34TangerI thought it might store it alongside the string data
08:21:38PMunch(Not sure if len is a proc by the way, might be some compiler trickery)
08:21:51PMunchI think it does..
08:21:57TangerI mean, I'll use an array of chars like you said, but now I'm just curious
08:24:22*jaco60 joined #nim
08:27:27PMunchIt appears like a "NimStringDesc" in the generated C code consists of a TGenericSeq sup, and a NIM_CHAR data[length+1]. The TGenericSeq consists of a NI len, and a NI reserved
08:27:51PMunchWhere NI is a Nim int, and NIM_CHAR I guess is a Nim character
08:28:07*Vladar quit (Quit: Leaving)
08:28:20PMunchProbably just typedefed to some static size (instead of using C's int and char which can vary in size by platform)
08:30:29PMunchThe len field obviously holds the length of the string, the reserved field holds length or-ed with NIM_STRLIT_FLAG, which is 1 << (NIM_INTBITS - 2)
08:31:26PMunchAnd NIM_INTBITS is the bitsize nim ints are set to (which I guess can vary by platform)
08:37:09PMunchIf you want to actually allocate page-aligned data I suggest writing a small wrapper around some C solution and passing back a pointer to something which you can then cast into a "ptr array" type.
08:38:45TangerAh, I think I get it. The or on the reserved field is to figure out how many bits are available in the string, right?
08:38:50PMunchOr rather do the casting in your wrapper, and return a "ptr array[0..PAGESIZE, char]"
08:38:50TangerYeah, that seems like the way to go
08:41:48PMunchNot entirely sure what the length | NIM_STRLIT_FLAG is for tbh
08:42:24PMunchThe flag seems to be used to identify strings, which makes sense
08:42:43PMunchNot sure why it's or-ed with the length though..
08:43:57*yglukhov quit (Remote host closed the connection)
08:44:40FromGitter<mratsim> Use an array, ref array, an arena/memory region.
08:45:17PMunchHow do ensure it doesn't span two pages though?
08:45:26FromGitter<mratsim> if you you work with strings use a distinct strings and create wrapper that comper the current length with the MAX_ALLOWED_LENGTH
08:45:34FromGitter<mratsim> that compare*
08:46:45FromGitter<mratsim> I don’t know how big pages are on your device, are they 4k like on x86? you can use a similar trick: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/fallback/blas_l3_gemm_data_structure.nim#L33
08:47:09FromGitter<mratsim> this is to make sure that data start on modulo 64-bit addresses
08:48:39cremdom96: does your https://github.com/dom96/deauther/blob/master/src/tui.nim work both in windows and linux? I think console display API is very different there.
08:49:47*FuntDobra_ quit (Ping timeout: 255 seconds)
08:51:47*yglukhov joined #nim
08:52:38*yglukhov_ joined #nim
08:53:06FromGitter<mratsim> Now that windows 10 has proper POSIX API it might work though?
08:54:48*nsf joined #nim
08:56:27*yglukhov quit (Ping timeout: 260 seconds)
09:00:10FromGitter<krux02> I have never used the ubuntu subsystem for windows, because last time I tried it, Windows broke.
09:00:35FromGitter<krux02> But that was a year ago I think
09:01:10FromGitter<krux02> I would like to know if bash on windows is really cool/useful
09:01:50FromGitter<krux02> I mean with utf8 symbols in output and using the keyboard
09:08:44*FuntDobra_ joined #nim
09:22:37*Vladar joined #nim
09:23:47*endragor joined #nim
09:26:02dom96crem: it uses termbox which indeed doesn't support windows
09:26:15crem:(
09:26:29cremNo terminal dashboard in nim then.
09:26:51*crem is back to fighting with golang.
09:29:01FromGitter<tim-st> any way I can 1) set a specific value for some indices and 2) default values for all other indices for an const array? I think golang has something like {k1: v1, k2:v2} where v1 is put at index k1 and v2 at index k2 and all other are default
09:35:31*skrylar_ quit (Remote host closed the connection)
09:38:23PMunchcrem, you should write one using the terminal module :)
09:42:39dom96crem: yeah, please write one instead of switching to golang so fast :(
09:43:13dom96You can port nimbox to nim and add Windows support at the same time, that would be a nice project.
09:43:15cremI need dashboard to be done by the end of the week, ideally in one evening. :)
09:43:27cremNo time for writing libs.
09:44:05cremUnless someone wants to help. That's for leela-chess project.
09:44:29*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:45:40dom96what is it?
09:47:37cremReimplementation of deepmind's alphazero for chess.
09:53:50*xkapastel quit (Quit: Connection closed for inactivity)
09:54:46PMunchcrem, have you seen https://github.com/FedericoCeratto/nim-dashing
09:55:25cremNope. Does it work in windows?
09:56:33PMunchIt says it's built on the terminal module, so I think it should
09:56:51PMunchHaven't used Windows for many years though, so never tried
09:57:23cremThere is terminal module.. I can use it directly then.
09:58:40PMunchYeah in the stdlib: https://nim-lang.org/docs/terminal.html
09:58:57federico3perhaps it can be tested on appveyor - please let me know
09:59:10PMunchIt's only the basics though, colours, moving the cursor, clearing the screen, that sort of thing
10:00:02cremCan it catch window resize?..
10:00:37PMunchWell you have terminalSize
10:00:51cremShould I poll it in a loop?
10:01:11PMunchWell
10:01:16PMunchDepends on what you are doing
10:01:27PMunchIf you want to draw a progress bar I'd just put it in the update procedure
10:01:33PMunchI have to run
10:07:16*dddddd joined #nim
10:11:37dom96yglukhov_: Couldn't resist: https://news.ycombinator.com/item?id=17081215 :)
10:13:20dom96crem: Is it just Windows that you're targetting?
10:13:33dom96I think you could write a library quite quickly :)
10:14:04cremNo, linux/windows/mac
10:14:47dom96You could probably reimplement the Go termbox library in Nim :P
10:14:48cremBut raw terminal library seems fine. Although I didn't touch nim since september and forgot everything.
10:15:38cremI have a really long TODO list in lczero project itself so wouldn't like to spend time on side libraries for now. :)
10:16:20*leorize quit (Ping timeout: 276 seconds)
10:16:46dom96Pity. But that's how these things go sadly
10:16:57livcddom96: small platform-specific bits needed for each.
10:17:11livcdreally just "small platform-specific bits" ? :D
10:17:42dom96yep
10:17:50dom96crem: Maybe you could use ncurses?
10:18:15livcdi thought that's an understatement
10:18:41dom96livcd: In relation to the whole game they are pretty small ;)
10:19:15cremBut why plain terminal is not enough? It's pretty fine. I don't like libraries in go too. I just need something like that: https://goaccess.io/images/goaccess-dashboard.png
10:19:31crem(surprisingly it's not written in go even though it has go in it's name)
10:20:36livcdjust curious why a tui app and not a webapp ?
10:21:39cremIt should be a thing that people run and see it does something, without having to find a way to check that.
10:21:59dom96crem: Terminal should work, but it might be missing important things
10:22:17cremAnd it would be nice it to be a single binary without any template files etc.
10:22:27*xet7 quit (Ping timeout: 240 seconds)
10:23:11livcdcrem: why not to use websockets and open a default browser for the user ?
10:23:53cremAlso I want to code it within one evening.
10:24:02cremmaybe two
10:25:21cremAll small things like how to transfer data to client, should there be some javascript which polls for new data etc, they all take some minutes from budget.
10:25:37cremI need something quick, people are actually blocked on this being done.
10:26:24*hitchhooker[m] joined #nim
10:30:13CodeVanceJust make a mvp
10:31:10dom96Do give `terminal` a try, even though it doesn't support resizing events I don't think that's all that important for a first version
10:34:10*Ven`` joined #nim
10:35:36*xet7 joined #nim
10:45:21cremHm.. also probably nim is not that good idea for project with many contributors..
10:47:24FromGitter<krux02> crem: Well what do you mean by "many contributors"
10:47:48FromGitter<krux02> Normally it is hard to plan for that
10:48:06FromGitter<krux02> most projects don't get contributors apart from the original authors
10:48:43FromGitter<krux02> and when a project is useful, it will get contributors no matter how obscure the programming language is
10:48:54livcddom96: do you know if impbox did the sound for vektor himself ?
10:48:59dom96livcd: he did
10:49:04dom96well
10:49:07dom96the sound effects
10:49:10dom96Don't think he did the music
10:50:44cremThe project has ~20 moderately active contributors, ~6 active ones. I'm afraid that if it will be in nim, noone except me would want to touch it. But I'm more optimizing for time to write actually. I surely would be the fastest in nim if I was fluent.
10:50:50livcdah just found it!
10:51:09livcdit's from @dubmood
10:51:19dom96crem: It would be a good opportunity to attract more towards Nim :)
10:52:01cremI already have steady stream of criticism for pickling meson as a build system for C++ instead of cmake. :)
10:52:51cremBut will most probably do in nim indeed. I like nim, just don't know. And go i neither like nor know.
10:53:38dom96Always happy to answer any questions or help you with any problems you run into :)
10:54:13PMunchNice subtle Nim plug there dom96 :P
10:54:25*FuntDobra_ quit (Ping timeout: 248 seconds)
10:54:32PMunchThe hackernews link you shared earlier
10:54:44*beatmox joined #nim
10:55:22dom96PMunch: :P
10:55:42cremOn windows, which C compiler nim compiles through, by default?
10:55:51PMunchMinGW I think
10:55:55PMunchA bundled version
10:56:05PMunchBut it supports both GCC and VCC as well
10:56:17cremGood. It doesn't need any .dll bundled together with binary, right?
10:56:34dom96nope, unless you use a library that needs it
10:56:39PMunchThe output of your program?
10:56:43PMunchOr the Nim compiler
10:56:45dom96(`re` module for example, or SSL)
10:57:15cremhttp client doesn't need any dlls? terminal module?
10:57:29cremgzip probably needs it, right?
10:57:46cremAnd there is gzip library, I assume.
11:00:18FromGitter<krux02> crem: I think if you use regular expressions, it needs a DLL
11:00:50cremI don't. Unless http client library secretly uses it.
11:01:15*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
11:12:04*Ven`` joined #nim
11:21:32yglukhov_dom96: hey, sure, spread the word! :)
11:21:37Araqit doesn't, the stdlib is not as bad as people claim
11:25:32cremWhat's the best way to write a program which should react on user input from stdin (mostly wait for 'q' pressed for exitting), on subprocess outputting to it's stdout, and update stats on timer. Three threads?
11:30:20FromGitter<mratsim> As a go player I’m more familiar with the go engines, how strong is Leela Chess now?
11:33:26*cspar joined #nim
11:36:20*CodeVance2 joined #nim
11:36:54dom96crem: httpclient only needs openssl if you are accessing https:// URLs
11:37:23*CodeVance quit (Read error: Connection reset by peer)
11:37:28dom96crem: https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp/src/client.nim#L39
11:37:47dom96Do it like i've done it there. You don't need that many threads, just one spawn and then poll it
11:37:55FromGitter<mratsim> that’s probably the most linked github repo in there :D
11:38:03dom96Soon we'll have the ability to `await` spawns
11:38:51dom96Interestingly, according to GitHub this is most popular: https://github.com/dom96/nim-in-action-code/tree/master/Chapter7/Tweeter
11:38:52*CodeVance2 is now known as CodeVance
11:43:00*yglukhov joined #nim
11:43:01*yglukhov_ quit (Read error: Connection reset by peer)
11:44:01*gb00s quit (Quit: Ping timeout (120 seconds))
11:44:51*gb00s joined #nim
11:48:52CodeVanceDom id love async await in nim
11:49:17*FuntDobra_ joined #nim
11:51:47FromGitter<krux02> I now get a warning Number of spaces around '+' is not consistent
11:52:01FromGitter<krux02> pretty annoying, because I have alignment in my code
11:55:25*yglukhov_ joined #nim
11:55:25*yglukhov quit (Read error: Connection reset by peer)
11:57:19*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
11:59:15*leorize joined #nim
12:01:22cremkrux02: it's ~2800 Fide Elo. There was some fall recently due to overfitting, but it's 2800 when it was good. :)
12:01:39crems/krux02/mratsim/
12:02:03cremdom96: thanks, will take a look
12:02:39dom96CodeVance: Hrm? Nim has async await
12:02:57CodeVanceKeyword
12:03:09CodeVanceAsync proc foo()
12:03:20dom96why?
12:03:45dom96That won't ever happen, it would require a significant change in Nim as a whole
12:03:51CodeVanceCause its easier... But it doesnt matter really
12:03:56CodeVanceI know
12:04:42dom96Writing {.async.} at the end of a proc is not difficult
12:04:52CodeVanceI agree
12:04:59CodeVanceWhat about await?
12:05:07CodeVanceAwait foo()
12:05:14CodeVanceDoes it have that?
12:05:17dom96yes
12:05:23CodeVanceThen nvm
12:07:47FromGitter<narimiran> @krux02 i think what warning is because of this: https://github.com/nim-lang/Nim/issues/7685
12:08:36FromGitter<narimiran> @araq @krux02 maybe this warning should be triggered only when there is both 0-space and n-space?
12:09:12FromGitter<narimiran> so it is triggered on `a - b+c`, but not on `a - b - c`
12:09:33FromGitter<narimiran> (gitter formatted my multiple-space example)
12:09:57FromGitter<narimiran> *not on `a__-_b____+____c`
12:16:16*rokups joined #nim
12:21:40PMunchWowzer: https://github.com/frol/completely-unscientific-benchmarks/issues/43#issuecomment-389497614
12:21:47PMunchSee frols last comment
12:26:41*Ven`` joined #nim
12:26:57*Snircle joined #nim
12:31:04FromGitter<krux02> @narimiran yea thank you, I would agree on that
12:32:14FromGitter<krux02> The problem with asky await is, it doesn't solve the question of, who is doing the job in async
12:32:37FromGitter<krux02> it just say says, "hey somebody, please do this async"
12:32:37*Ven`` quit (Read error: Connection reset by peer)
12:33:10*Ven`` joined #nim
12:33:10FromGitter<krux02> In the past when I didn't know a lot about parallel programming I loved asky await, because it is so trivial.
12:33:29FromGitter<krux02> But now that I know about thread creation, I am not that happy about it.
12:34:32FromGitter<krux02> I think async await shold should have a thread/threadQueue parameter
12:56:48FromGitter<Quelklef> in
12:57:06FromGitter<narimiran> humble brag: my article about python vs numpy vs nim has made it to 'pycoders weekly' newsletter :)
12:58:11FromGitter<survivorm> Great!
12:58:24FromGitter<survivorm> Good work :)
12:59:06cremNo any protobufs support in nim so far, is there?
12:59:08dom96narimiran: nice!
12:59:23dom96crem: PMunch created one IIRC
12:59:47*athenot joined #nim
13:00:06FromGitter<narimiran> thanks @survivorm @dom96! now when python crowd discovers nim and the number of users explode.... :D
13:00:47FromGitter<Quelklef> in ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ What is `fun(val)` doing, exactly? My best guess is that it's applying `f` Beta-reduction-style, resulting in the code `echo(3)` for the body of `proc \`fun\`()` [https://gitter.im/nim-lang/Nim?at=5afc2b7ee0b50c2d05c86bce]
13:00:49PMunchcrem, I think there are 3 :)
13:00:56PMunchOr four, I've lost count
13:00:57FromGitter<Quelklef> (Sorry to interrupt, great work @narimiran !)
13:01:15PMunchOh yeah, congrats @narimiran!
13:01:47PMunchcrem, you can grab mine from nimble, it's named "protobuf"
13:02:33PMunchOnly supports protobuf3 though, but if you look at my GitHub page I link to another supporting 2 as well. But it requires the protoc compiler, mine just uses a Nim macro :)
13:10:10cremWhat's the best choice (less code to type, and human editability is a plus) for config file format for nim app? Does everyone write json? Is there .ini or .yaml support maybe. (writeable but ideally one which would keep existing comments)
13:11:07PMunchTOML?
13:11:09livcdGo community likes toml :)
13:11:43PMunchI recently updated this https://github.com/ziotom78/parsetoml to support TOML 0.4.0 (latest spec)
13:12:08cremLooks good! It supports both read and write? (and retaining existing comments)
13:12:31PMunchIt does write, but comments are deleted
13:12:37flyxNimYAML is not able to preserve comments because I honored the specification.
13:13:02cremOk, toml then. Who needs those comments anyway.
13:26:16PMunchI was considering to write a TOML parser that would parse formatting and comments as well. But figured as we already have one there wasn't really much point.
13:29:02cremIf user has nothing related to nim installed, and I have nim source (with dependencies like toml parser), how many commands would he need to type to get compiler binary? Download/install nim, clone my repo and then?
13:42:57PMunchNice, the Nim optimized version is now the fastest: https://github.com/frol/completely-unscientific-benchmarks#linux-arch-linux-x64-intel-core-i7-4710hq-cpu-1
13:43:27PMunchnimble install in the repo
13:43:39PMunchIf nimble does dependencies, which I think it does
13:48:25PMunchInteresting note about the mark-and-sweep, running the example with refc achieved the same memory consumption as manual allocation, but slower. Using mark-and-sweep was as fast as manual allocation, but used more memory
13:48:33PMunchNumbers: https://github.com/frol/completely-unscientific-benchmarks/issues/43#issuecomment-389512644
13:49:10PMunchI think I'll have to write a post on all of this. A lot of interesting stuff
13:49:29FromGitter<Quelklef> Wow, I never realized how slow CPython really is
13:49:31FromGitter<Quelklef> That's a shame
13:50:16PMunchYeah, that 68x slowdown over Nim is pretty brutal
13:51:20FromGitter<Quelklef> 1) 2x right?
13:51:23FromGitter<Quelklef> b.c nim is 5.6x
13:51:44PMunchLook in the "Tuned" section ;)
13:52:25PMunchNim optimized version with mark and sweep or manual allocation is the fastest of the bunch :)
13:52:33FromGitter<Quelklef> Ah, I gotcha
13:52:38FromGitter<Quelklef> Go Nim!
13:52:44FromGitter<mratsim> @PMunch, seems like I will have to use Protobuf for Arraymancer as well. The neural net community (FB and Microsoft especially) settled on it for the neural network exchange format.
13:54:04PMunchOooh, interesting
13:54:17PMunchI have an update I want to make that will speed up the parser :)
13:54:28PMunchGot all the code, just need to test it a bit more
13:54:37*endragor quit (Remote host closed the connection)
13:55:07*endragor joined #nim
13:56:27FromGitter<mratsim> see here: https://github.com/onnx/onnx#source
13:58:48PMunchIt's all proto3 and without options so they should work out of the box with my library .)
13:59:33*endragor quit (Ping timeout: 256 seconds)
13:59:41*gokr quit (Quit: Leaving.)
14:00:07*leorize quit (Ping timeout: 256 seconds)
14:03:13*FuntDobra_ quit (Ping timeout: 248 seconds)
14:03:53FromGitter<mratsim> awesome
14:04:42PMunchIf not you can always use the other one
14:04:49PMunchIt has a bit less vodoo in it though
14:05:15FromGitter<mratsim> I think Arraymancer is already pretty high on Voodoo-ness anyway.
14:05:55PMunchWell this is strange meta-programming voodoo
14:06:08*athenot quit (Ping timeout: 255 seconds)
14:07:19PMunchIn protobuf all fields are optional, but I didn't want the user to need to use strange procedures to read and write fields. So protobuf uses the `.` and `.=` operators to update an internal record of what is set and not. Then it writes only those that are set.
14:07:43PMunchSo you can actually get an error on field access if you don't use the `has` thing
14:07:53PMunchIt's all explained in the README :)
14:08:34FromGitter<mratsim> so there is `.` overload?
14:08:45PMunchYup
14:09:14FromGitter<mratsim> That will be removed though, @Araq?
14:09:16PMunchI might add a switch to not do it though, considering how it's an experimental feature
14:09:41PMunchBut then you have to use an ugly get/set interface
14:10:15FromGitter<mratsim> can’t you just macro with `field` and `field=`?
14:10:36PMunchNope, that pollutes too much
14:10:40PMunchWith strange names
14:10:56PMunchAnd it caused collisions IIRC
14:10:59PMunchI guess it could overload the `[]` instead..
14:11:25FromGitter<mratsim> yeah that would be better. Or `{}` if it’s available.
14:11:37PMunchHmm, Nim's handling of {} is a bit strange though..
14:11:46PMunchOh well, that'll have to wait. I'm off
14:12:09PMunchNorways national day tomorrow :)
14:12:43*PMunch quit (Quit: Leaving)
14:15:26dom96crem: If using choosenim then just two :)
14:15:29*xet7 quit (Quit: Leaving)
14:16:02cremIs choosenim something to be installed in addition to nim, or just instead?
14:16:29FromGitter<mratsim> choosenim is a helper
14:16:48FromGitter<mratsim> install choosenim and then using to maintain your nim installation(s)
14:17:05FromGitter<mratsim> —> choosenim update devel ⏎ —> choosenim install stable
14:17:20FromGitter<mratsim> use it*
14:17:42cremI just need a build instructions from scratch to ready binary in as few steps as possible. (not for myself, and not for developing)
14:18:03cremI do have choosenim installed, but I don't remember in which order I installed things.
14:19:00FromGitter<mratsim> something like this? https://github.com/mratsim/Arraymancer#installation
14:19:39cremAnd for choosenim, there is a ready installer for windows?
14:19:51cremfound it, thanks.
14:19:53*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14:20:15*leorize joined #nim
14:20:20FromGitter<mratsim> If your project is a binary, once it’s nstalled the binary is added to path, like here: https://github.com/status-im/nimbus-launch#installation
14:23:18*xet7 joined #nim
14:26:39*m712 quit (Quit: bye-nyan!)
14:26:59*m712 joined #nim
14:27:39*m712 is now known as mission712
14:27:41*mission712 is now known as m712
14:30:41*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
14:31:37*Ven`` joined #nim
14:33:42FromGitter<mratsim> Nim is the current fastest language =) https://github.com/frol/completely-unscientific-benchmarks#linux-arch-linux-x64-intel-core-i7-4710hq-cpu-1
14:37:47*CodeVance quit (Read error: Connection reset by peer)
14:37:50*CodeVance2 joined #nim
14:37:51FromGitter<Quelklef> Nim compiles to C so C is the fastest /s
14:38:20FromGitter<mratsim> Assembly is the fastest?
14:38:27FromGitter<Quelklef> oh shit
14:38:53FromGitter<Quelklef> Honestly though making new hardware for each program is the fastest
14:39:21*CodeVance joined #nim
14:39:38*CodeVance2 quit (Read error: Connection reset by peer)
14:39:45*CodeVance quit (Client Quit)
14:40:14FromGitter<krux02> yea maybe in the future we will all program FPGA for high performance.
14:40:38FromGitter<krux02> But before that happens we still need a programming language that is feasible to work with.
14:40:46FromGitter<mratsim> Well, it takes several months/year to get ASICs and GPUs out ;)
14:40:57FromGitter<Quelklef> What's FPGA?
14:41:08FromGitter<krux02> field programmable gate array
14:41:27FromGitter<Quelklef> "A field-programmable gate array is an integrated circuit designed to be configured by a customer or a designer after manufacturing" holy moly
14:41:32FromGitter<Quelklef> That sounds cool
14:41:52FromGitter<krux02> well it is
14:42:05*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14:42:34FromGitter<krux02> at my university we had a task where we did implement a CPU on an FPGA
14:42:49FromGitter<Quelklef> that also sounds cool
14:42:53FromGitter<Quelklef> oman
14:42:58FromGitter<krux02> it was a 4 bit CPU
14:43:08FromGitter<krux02> 4 * 4 was an overflow
14:43:18FromGitter<Quelklef> lol
14:43:25FromGitter<Quelklef> no cpu is perfect
14:43:36FromGitter<Quelklef> we all have our problems
14:45:01FromGitter<krux02> in the future we will have an FPGA backend for Nim
14:45:08FromGitter<Quelklef> I remember two years ago in compsci we made I think a two-bit adder on pencil boxes. that wa sfun
14:45:22FromGitter<Vindaar> if FPGA programming wasn't so annoying (thinking mainly about the whole toolchains etc.) :/ "Xilinx: Please download our 15 GB software package that's a PITA to use..."
14:46:00FromGitter<krux02> exactly I remember that downloading that software
14:46:04FromGitter<krux02> did take a while
14:46:09FromGitter<Vindaar> yeah
14:46:13FromGitter<mratsim> https://github.com/nim-lang/Nim/wiki/GSoC-2014-Ideas#add-a-code-generator-for-openclhttps://github.com/nim-lang/Nim/wiki/GSoC-2015-Ideas#add-a-code-generator-for-opencl
14:46:32FromGitter<krux02> but nowadays 15 GB isn't as bad as the 10 GB were when I did the download
14:46:38FromGitter<krux02> it was 8 years ago I think
14:47:34FromGitter<mratsim> Ah, Intel is also good with 8GB software+compiler+whatever for scientific computing, and then you have to put your license in a specific place, but the website is super confusing...
14:49:22FromGitter<krux02> I like the way NVidia works. Everything is for free, but you need NVidia hardware :P
14:49:50FromGitter<mratsim> and you need breaking your Xorg/mesa/libGL driver every 6 months as well.
14:50:10FromGitter<Vindaar> it's why I hardly ever update my Nvidia drivers on my desktop machine :P
14:50:28FromGitter<krux02> well that is new to me, but I am developing on a computer that I do not maintain on my own
14:51:24FromGitter<krux02> or I develop on my 2010 laptop with intel graphics chip
14:51:42*darithorn joined #nim
14:51:49FromGitter<krux02> normally when I do that i disable the graphics chip entirely and run OpenGL in software.
14:51:59FromGitter<krux02> that provides me a newer version of OpenGL
14:52:28FromGitter<krux02> (super slow but for my tiny rendering examples that want to be absolutely minimalisting, they are exactly the right thing)
14:52:53*CodeVance joined #nim
14:53:03FromGitter<Vindaar> on my laptop under Linux I also always disable my Nvidia GPU and use the Intel one
14:53:30FromGitter<mratsim> I have a GTX1070 but never connected a screen to it =).
14:53:42FromGitter<krux02> interesting
14:53:54FromGitter<Vindaar> that's fine until you want to run some CUDA code again and have to tread the "CUDA on a Nvidia Optimus laptop" waters again...
14:53:57FromGitter<krux02> I would connect a screen to it, so I can play stardew valley :P
14:54:37*BitPuffin joined #nim
14:55:07FromGitter<mratsim> One day :P I have 2x27” screen at home but I have no space ….
14:55:17FromGitter<Vindaar> can you overclock an Nvidia GPU nowadays under Linux if you don't connect a screen to it?
14:55:37FromGitter<mratsim> I think you still need at least xorg installed
14:55:53FromGitter<mratsim> and modify xorg.conf
14:56:16FromGitter<Vindaar> ah, possibly yes
15:01:44*xet7 quit (Ping timeout: 260 seconds)
15:08:31*gokr joined #nim
15:11:13*miran joined #nim
15:13:36*leorize quit (Ping timeout: 268 seconds)
15:18:50*FuntDobra_ joined #nim
15:19:31FromGitter<krux02> @mratsim for quite some time I had an office with 5x3 screens. The computer for them had 4 GPUs and 128 gb ram
15:19:46*xet7 joined #nim
15:19:52FromGitter<mratsim> And it was used to power Vim? :P
15:20:02FromGitter<krux02> that office was a total waste of money. But it wasn't my money and I was working in it.
15:20:23FromGitter<krux02> the screens coverd one side of the entire room
15:20:53FromGitter<krux02> I don't know the sizes of the monitors anymore, but they were big
15:21:10FromGitter<krux02> and the screens showed the entire day a endless loop of nature relaxation
15:21:25FromGitter<krux02> I had sunset after sunset at miami beach
15:21:46FromGitter<krux02> because of the size of the screen it felt more like a window to the beach than a screen
15:21:55FromGitter<krux02> and I had that in the Winter
15:22:01*gokr quit (Quit: Leaving.)
15:22:39FromGitter<krux02> That was a good time
15:22:49FromGitter<krux02> sadly my contract wasn't continued
15:22:56FromGitter<krux02> the research project I worked on ended.
15:24:26FromGitter<krux02> And it didn't really feel like it ended in a good way.
15:24:52FromGitter<krux02> it was missing the finished job tag
15:24:57FromGitter<krux02> it just stopped
15:25:19CodeVanceUse a projector?
15:25:50*rokups quit (Quit: Connection closed for inactivity)
15:26:58FromGitter<krux02> no it is not the same
15:27:31FromGitter<krux02> There is another lab at my university they use projectors for a virtual reality cave.
15:27:46FromGitter<krux02> like a real life holo deck.
15:28:14FromGitter<krux02> it is a 5m*5m room with glass walls and glass floor.
15:29:44FromGitter<krux02> well before I explain it, just look at that thing https://www.vr.rwth-aachen.de/media/resource_images/20150928-aixCAVE_RWTH_logo-00013.jpg
15:29:50federico3remember not to throw stones
15:29:57FromGitter<krux02> yes
15:29:58federico3(sorry I couldn't resist)
15:30:34FromGitter<krux02> I mean on a picture it seems much smaller than it actually is
15:31:04FromGitter<krux02> the building was constructed for that VR cave, not the other way around.
15:31:15FromGitter<tim-st> when I create a `newSeqOfCapint32 (3)` inside my proc is that created at runtime or is the capacity space somehow reserved at compile time and only if I resize it is costly?
15:31:28FromGitter<krux02> what you don't see are the projectors in the floor that project on the floor
15:31:40FromGitter<krux02> from below
15:31:48FromGitter<krux02> that that you have full immersive VR
15:32:11FromGitter<krux02> you get in there with 3D glasses like you know them from 3D cinema
15:32:14*xet7 quit (Ping timeout: 276 seconds)
15:32:38FromGitter<krux02> and the projectors around you transform the room that you are in into a 3D world
15:32:51FromGitter<krux02> you see yourself and you see the VR world
15:33:15FromGitter<krux02> wich rift and vive you always have invisible hands, in this cave you have nothing invisible
15:33:23FromGitter<krux02> and no problem of resolution
15:35:28*athenot joined #nim
15:36:11*xkapastel joined #nim
15:43:33*xet7 joined #nim
15:44:42*nsf quit (Quit: WeeChat 2.1)
15:54:33FromGitter<mratsim> @tim-st seq are GC-ed types under the hood, you can’t allocate GC-ed and pointer types at compile-time
15:55:54FromGitter<mratsim> you need an address to allocate from, but ref and ptr types are asking the OS (via alloc in Nim/malloc in C) “Give me an address"
15:56:26FromGitter<mratsim> if you want compile-time pre-allocation use an array. (That makes your binary bigger)
16:07:24*tiorock joined #nim
16:07:24*tiorock quit (Changing host)
16:07:24*tiorock joined #nim
16:07:24*rockcavera is now known as Guest1478
16:07:24*Guest1478 quit (Killed (kornbluth.freenode.net (Nickname regained by services)))
16:07:24*tiorock is now known as rockcavera
16:08:45*sendell quit (Remote host closed the connection)
16:10:12FromGitter<krux02> @mratsim you can use seq types at compile time, you just can't use the addr of them
16:10:50FromGitter<mratsim> yes but compile-time seq are transformed into fixed size arrays at runtime.
16:11:15FromGitter<mratsim> so they are not heap-allocated/GC-managed.
16:19:13*floppydh quit (Quit: WeeChat 2.1)
16:39:26FromGitter<tim-st> @mratsim Thanks, I already assumed this, I now changed my code a bit complexer to avoid seqs completely instead of creating a buffer each time I call the proc
16:41:05FromGitter<tim-st> the problem was that only in 99% the capacity is enough, so I cant use array
16:42:09FromGitter<krux02> @tim-st well the key to performane is to reuse allocated memory
16:42:49FromGitter<krux02> allocating memory is not free
16:43:22FromGitter<krux02> there are many different memory pool models that you can use to quickly reuse existing memory.
16:43:24FromGitter<tim-st> yes, and I could reuse it (in other languages they use and object for this that supply the proc and access the allocated memory) but then I think it is not thread safe?
16:43:32FromGitter<krux02> malloc is generally a very slow operation
16:43:48FromGitter<tim-st> (I meant the lib that I create is in other language created this way)
16:44:24FromGitter<krux02> I hate that that expression "thread safe", becaus for the most part the question "is it thread safe?" is wrong
16:45:23FromGitter<krux02> with thread safety you have to be very specific about what part you want to have thread save.
16:45:37FromGitter<tim-st> I dont use this normally^^, but now I found a way to nest 4 cases with 4 cases that is more code but doesnt need allcoating
16:45:44FromGitter<krux02> if you want to make "everything" thread safe you will die in synchronization overhead
16:46:11FromGitter<mratsim> hide that in a template/inline proc
16:46:43FromGitter<mratsim> you don’t want to have that everywhere.
16:46:50FromGitter<tim-st> yes, I used inline proc for now, and for many cases I can swap the params to fit
16:47:14FromGitter<tim-st> e.g. cmpTable(a,b) and (b, a)
16:47:19FromGitter<krux02> When you only have one thread "is it thread safe?" can be answered with "yes, because there is only one thread"
16:47:58FromGitter<mratsim> allocating once and reusing works fine, I do that for my go playing bot. (otherwise I would have to create 12k seqs per second)
16:48:50FromGitter<tim-st> yes, that was exactly my idea behind is that much worse? I mean if the capacity is nearly never reached?
16:48:55FromGitter<mratsim> for multithreading I can just allocate once per thread and threads do not share
16:49:22FromGitter<krux02> @mratsim yes that is basically the best multithreading approach
16:49:28FromGitter<mratsim> static arrays have this capacity problem, seq have dynamic capacity, you only use what you need
16:49:36FromGitter<krux02> it is what MPI does as well.
16:50:22FromGitter<krux02> allocate at initialization stage and then reuse as much as possible
16:50:51FromGitter<krux02> it is best when you can reduce your program to a single allocation call
16:51:02FromGitter<tim-st> ok, thanks both, good to know, I think my uca lib could be quite quick
16:51:14FromGitter<krux02> even though that is unrealistic for most cases
16:51:39FromGitter<tim-st> is "alloc call" only seq and string and ref objects?
16:51:41FromGitter<mratsim> for arraymancer, the metadata for tensors (1D tensors = vectors, 2d tensors = matrices, 3D tensor = ???? …) is so heavily used that seqs were a bottleneck. I decided to support only up to 7 dimensions by default. + len which makes it 64-bit. but often I only need 1D to 4D and dimension 5, 6, 7 are just a waste of space.
16:52:04FromGitter<krux02> @tim-st it is also create for ptr objects
16:52:04FromGitter<mratsim> @tim-st yes.
16:52:15FromGitter<krux02> but generally yes
16:52:35FromGitter<mratsim> 7 dimensions = static arrays*
16:52:40FromGitter<tim-st> ok, then I think I have zero allocation, there is one proc that returns array[2, tuple[int32]]
16:53:12FromGitter<mratsim> that’s on the stack, it’s fast enough, probably 100x faster than heap
16:53:44FromGitter<krux02> but stack is only 2MB I think, so for everything that uses memory, you probably need to allocate
16:53:46FromGitter<tim-st> btw @mratsim I told you some time ago that I had trouble with you rocksdb lib on windows, as it turned out, it was indeed the offical dll that doesnt work on windows, there is even an issue on their rocksdb page
16:53:49*brainproxy quit (Quit: WeeChat 2.1)
16:54:04FromGitter<tim-st> so with an older version it workd
16:54:25FromGitter<tim-st> Hm, maybe I can avoid stack too
16:54:35FromGitter<mratsim> ah good to know. I still don’t use rocksdb in prod
16:54:39FromGitter<krux02> well then you avoid using memory
16:54:47FromGitter<tim-st> ok, hahaa^^
16:54:50FromGitter<mratsim> the only way to avoid stack is by avoiding doing computation
16:55:24FromGitter<krux02> or by using stackless python :P
16:55:26FromGitter<tim-st> what do you use instead of rocksdb?
16:55:41FromGitter<tim-st> I thought about lmdb for read intensive and low writes
16:55:53FromGitter<mratsim> here is an article on stack vs heap @tim-st: I had another in mind that I sent to miran recently but have to find it again: http://www.insideloop.io/blog/2014/09/15/arrays-in-fortran-c-c-part-i/
16:56:37miranyou have sent me? why did i forget that?
16:56:43FromGitter<mratsim> for now nothing =), rocksdb will be used for a Ethereum/Blockchain virtual machine written in Nim: https://github.com/status-im/nimbus
16:56:48FromGitter<tim-st> thanks, will read this :D
16:57:34FromGitter<tim-st> ok
16:58:37FromGitter<mratsim> maybe this? https://stackoverflow.com/questions/161053/which-is-faster-stack-allocation-or-heap-allocation ⏎ ⏎ on_stack took 2.070003 seconds ⏎ on_heap took 57.980081 seconds [https://gitter.im/nim-lang/Nim?at=5afc633da2d951363345930b]
16:58:50FromGitter<mratsim> there was a clean table in the article I’m looking for
16:59:43FromGitter<mratsim> and pool allocation benched as well (as fast as stack iirc)
17:00:05FromGitter<tim-st> thanks for the info :)
17:03:07*darithorn quit (Quit: Leaving)
17:15:43FromGitter<Varriount> One memory allocation methods is to just never deallocate memory.
17:16:09FromGitter<Varriount> Then you can just use a bump allocator.
17:27:43FromGitter<Vindaar> @krux02 Ohh, you're at RWTH Aachen? *waves from Uni Bonn*
17:35:41FromGitter<krux02> @Vindaar waves back
17:43:09*Vladar quit (Quit: Leaving)
17:46:05*CodeVance quit (Read error: Connection reset by peer)
17:48:53*athenot_ joined #nim
17:49:57*CodeVance joined #nim
17:50:00*athenot quit (Ping timeout: 255 seconds)
17:57:27*thomasross_ joined #nim
17:57:46*Vladar joined #nim
17:57:56*nsf joined #nim
18:00:33*thomasross quit (Ping timeout: 248 seconds)
18:33:32*jxy quit (Quit: leaving)
18:36:00*jxy joined #nim
18:37:29*yglukhov_ quit (Read error: Connection reset by peer)
18:45:58*yglukhov joined #nim
18:57:30*athenot_ quit (Ping timeout: 256 seconds)
19:10:17*athenot joined #nim
20:00:48FromGitter<diegogub> helloo, Anyone compiling nim from osx for linux server?
20:02:40dom96I just install Nim on my linux server :P
20:04:01FromGitter<krux02> I use nim on Linux, but I compile it from the git repository
20:07:05FromGitter<diegogub> @dom96 yeah, I think is the easiest ..Im using docker, just wanted to keep it small..
20:07:38*DarkArctic_ joined #nim
20:09:41*ofelas quit (Ping timeout: 276 seconds)
20:10:05*athenot_ joined #nim
20:11:24*athenot quit (Ping timeout: 265 seconds)
20:11:29*DarkArctic quit (Ping timeout: 260 seconds)
20:12:12*DarkArctic_ quit (Ping timeout: 255 seconds)
20:14:59*athenot_ quit (Ping timeout: 276 seconds)
20:25:03*athenot joined #nim
20:28:11*nsf quit (Quit: WeeChat 2.1)
20:41:18*athenot_ joined #nim
20:42:11*athenot quit (Ping timeout: 276 seconds)
20:44:53*miran quit (Ping timeout: 276 seconds)
20:45:41*vivus joined #nim
20:55:48*vegax87 quit (Ping timeout: 256 seconds)
20:56:58*athenot joined #nim
20:57:53*athenot_ quit (Ping timeout: 255 seconds)
20:58:38*FuntDobra_ quit (Ping timeout: 256 seconds)
21:01:51*vegax87 joined #nim
21:15:58FromGitter<zetashift> Isn't Aachen really close to a Dutch province?
21:19:53*athenot quit (Ping timeout: 276 seconds)
21:21:50*athenot joined #nim
21:24:37*sz0 joined #nim
21:28:39*gokr joined #nim
21:46:37*athenot quit (Ping timeout: 265 seconds)
21:46:45*athenot_ joined #nim
21:58:08*noonien quit (Quit: Connection closed for inactivity)
22:01:24*rockcavera quit (Remote host closed the connection)
22:06:19*jaco60 quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:13:07*heitzmann joined #nim
22:23:19*athenot joined #nim
22:23:21*athenot_ quit (Ping timeout: 240 seconds)
22:28:00*Vladar quit (Quit: Leaving)
22:28:06*athenot quit (Ping timeout: 255 seconds)
22:38:38*rockcavera joined #nim
22:40:23*skrylar joined #nim
23:08:18*DarkArctic_ joined #nim
23:12:58*DarkArctic_ quit (Ping timeout: 264 seconds)
23:25:53*xet7 quit (Remote host closed the connection)
23:31:53*CodeVance quit (Ping timeout: 256 seconds)
23:52:51*skrylar quit (Remote host closed the connection)