related_post_gen benchmark

2023-10-11 Thread Araq
> The whole point of benchmarks is to show "How easy/hard is optimizing things > in this PL?" \- I think my Nim example argues for "In Nim it's easy". The point can also be "how hard is it to produce a performant solution" or "how performant is the 'idiomatic' solution" and Nim's foolish copying

Nim boilerplate

2023-10-11 Thread ElegantBeef
See I was going to do that but it felt like it was a bad faith argument. The following is a more good faith argument. import traitor #https://github.com/beef331/traitor/tree/master type Unit = concept proc act(_: Self) Marine = object Tank = object

Nim boilerplate

2023-10-11 Thread xigoi
Let me try… type Unit = object act: proc() func newMarine() = Unit(act: proc() = echo "marine acted") func newTank() = Unit(act: proc() = echo "tank acted") let units = [newMarine(), newTank()] for unit in units: unit.act R

Workaround to use multiples asynchronous sockets on Windows (to bypass OSError 10038 and 10055).

2023-10-11 Thread MauriceLambert
Thank you for your reply ! It's very interesting! But this doesn't solve my problem for many reasons: * I can add hosts and ports and I'm going to break my program on the new limit * Error code 10055 isn't really a problem, when I don't have resources I wait and restart the connection b

Nim boilerplate

2023-10-11 Thread Araq
> Would you agree? I don't know. Depends on your personal preferences and problem domain. Old-school OO can be the right model too and Nim is kinda poor at it by design: 1. More sugar can be implemented as a macro. 2. Takes away resources from features considered to be more important such as

Nim boilerplate

2023-10-11 Thread LokeX
Araq: very funny... as it turns out, there was a way to write what I wanted without the ceremony, even if my example code was idiotic: It was inspired by some horrible go interface examples littered on the web. What I take away from it though is, that it's enough (better even) to just match on p

Nim boilerplate

2023-10-11 Thread alexeypetrushin
I meant good luck writing code modelling starcraft game, without OOP and having clean code. Many real games use something like EntityComponentSystem. But as far as I understand, the reason is not that the code is cleaner or better, but because given the language problems, lack of expressiveness

Nim boilerplate

2023-10-11 Thread LokeX
Yeah, I get that, but it was not the point, though...

Nim boilerplate

2023-10-11 Thread ElegantBeef
Now maybe I'm an idiot, but did you not just say "Good luck doing polymorphism without polymorphism"? As far as I know Typescript interfaces used in the way you showed is polymorphism.

Nim boilerplate

2023-10-11 Thread Araq
Oh, it's 1990 again. A dog is an animal and a cat is an animal and both are 4 legged animals and both can make sounds. Such a great way to model things that never got replaced by something better (sum types, entity-component frameworks, ...).

Nim boilerplate

2023-10-11 Thread alexeypetrushin
About FP, good luck doing this in Nim [playground](https://www.typescriptlang.org/play#code/JYOwLgpgTgZghgYwgAgKomGZBvAUM5RMACgEoAuZANwHtgATXAX11wQBs4BnL5AWThRQKYAFsADuwiiI4Xukw58hBCQrU69HMgQ0QXGlIB07GgHNiAclGDhKyPUulkLFm049kAFTggA1shiktKyYPIYWHgERGSUtAzauvqGECbmVmC+AUQQjs6urElcWACuEVyUCmAA2gC6yAC

related_post_gen benchmark

2023-10-11 Thread cblake
Re: 8% - `jsony` also seems to use `std/tables`. You can tell from the extra `dt`, `dt2` instrumentation how small a fraction the initial hashing is. I get ~ 1%. And I never said it fulfilled all the rules..some of which are just dumb. It would be very easy to boost to 128 tags and 2^32 posts i

Why is building the community and ecosystem such a struggle?

2023-10-11 Thread dwhall256
Evan Czaplicki, the creator of the language elm, recently shared [his thoughts](https://www.youtube.com/watch?v=XZ3w_jec1v8) on this very topic

Workaround to use multiples asynchronous sockets on Windows (to bypass OSError 10038 and 10055).

2023-10-11 Thread rockcavera
Look at this [here](http://smallvoid.com/article/winnt-tcpip-max-limit.html). Sounds a lot like the limitation you're describing.

Nim boilerplate

2023-10-11 Thread Calonger
@aEverr says correcet , your concept is recursive make no sense. type CircleShape = concept a buildCircleProps(a) proc buildCircleProps[T](a: T) = discard proc buildCircleProps(a: CircleShape) = ... Run Wrong ! Remove buildCircleProps from con

related_post_gen benchmark

2023-10-11 Thread inv2004
Nice implementation. Unfortunately I do not think it will not pass "Rules" mention in the initial PR

Nim boilerplate

2023-10-11 Thread alexeypetrushin
> will help you adapt to Nim That's the wrong way. The main problem in programming is the weak human mind. And the goal of the language is to provide a way and abstractions for humans, that work well with human mind. Programming is not about machines, not about "memory layout" or "GC" or "zero

related_post_gen benchmark

2023-10-11 Thread inv2004
Anyway, smth does not match: let tt {.cursor.} = tagMap[tag] for otherIDX in tt: Run cursor for extra-sure => 24ms for otherIDX in tagMap.getPtr(tag)[]: Run => 19ms pretty huge diff

related_post_gen benchmark

2023-10-11 Thread cblake
FWIW, there is a way to make the hashing part barely matter at all, at least for 5000 posts and tag distributions like the posts.json in the repo. I actually got a run time about 75% of the one in the repo from PMunch (with both compiled with `-d:danger`) - just one 1 CPU. No idea about github C

related_post_gen benchmark

2023-10-11 Thread inv2004
Looks like some compilation ghosts - after cleaning cache - it looks ok in initial bench

related_post_gen benchmark

2023-10-11 Thread Araq
So use something like: import std/tables import std/monotimes import std/times import std/sequtils proc main() = var t = initTable[int, seq[int]](1000) for i in 0..99: t[i] = newSeqWith(1_000_000, 1) let fakeSeq = newSeqWith(1_000_

related_post_gen benchmark

2023-10-11 Thread inv2004
JFI: looks like PR did not help. `eqcopy` is still 62% of bench

related_post_gen benchmark

2023-10-11 Thread didlybom
FYI, this benchmark has made it to the hacker news front page:

Nim boilerplate

2023-10-11 Thread xigoi
What exactly is the code supposed to do?

related_post_gen benchmark

2023-10-11 Thread inv2004
It reminds me k-nucleotide bench - it was exactly how to pack hash. But I hope the bench is not to dig so deep

Workaround to use multiples asynchronous sockets on Windows (to bypass OSError 10038 and 10055).

2023-10-11 Thread MauriceLambert
I'm trying to use a lot of asynchronous sockets on Windows and I'm having several problems and ultimately most sockets don't work. With less than 1000 asynchronous sockets there is not error, from 1000 to 5000 asynchronous sockets i get a OSError with error code 10055. This error is raised in t

Nim boilerplate

2023-10-11 Thread juancarlospaco
Literal 2 lines in a lang with metaprogramming is too much boilerplate ?. 🤔

related_post_gen benchmark

2023-10-11 Thread Araq
> And Nim is a fine language with which to implement a database (a test used by > some to define a "systems PL"). The true definition of "systems PL" is "programming where constant factors matter". ;-) Though my personal one is "conveniently accessible packed data (without indirections) + type

related_post_gen benchmark

2023-10-11 Thread cblake
@inv2004 \- if all you want to do is use this as an exercise to learn / teach this specific benchmark, you could be sure to pack the whole problem into an L2-CPU by using the techniques of to **_pack a whole hash cell into just 8 byte

Use SciKit-learn for machine learning from Nim? (Andreas please read!)

2023-10-11 Thread Kancaxet
Consider the possibility of contacting to professionals well-versed in SciKit-learn

Nim boilerplate

2023-10-11 Thread LokeX
Hey, thanks mate! I can't get the: a.kind is Circle Run to work. But i got this: type ShapeKind = enum Circle,Rectangle ShapeProps = tuple[shape:string,area,perimeter:float] CircleShape = concept a a.r proc buildCirclePr

Nim boilerplate

2023-10-11 Thread mildred
Concepts are really not like Go-style interfaces Concepts is a generic type. The type is made concrete at compile time and you will never be able to distinguish behavior at runtime between you different types If you want to have interfaces, you should probably use them instead using one nimble

Why is building the community and ecosystem such a struggle?

2023-10-11 Thread ITwrx
My biggest problem with the forum is the lack of notifications. New users post a question, someone answers, and the new user never gets notified that anyone ever responded. That's pretty embarrassing and inexcusable for a forum. No notifications on user_mention, replies to a post/comment, nor a

related_post_gen benchmark

2023-10-11 Thread Araq
> I am from perf point of view. Hardly. So: * With lent: `[]` does not do the deref but the caller does as the address is irrelevant. * Without lent: `[]` does do the deref in order to hand you an `int` and the caller does not have to deref. So in both cases there is an address computati

Nim boilerplate

2023-10-11 Thread mashingan
Reworked your example, apparently the `a` in your concept is not concrete type (or just alias?) which simply can be anything, hence you need to "pin" it down with `T` as anything. By defining the argument as concrete type, it can match the type: from math import PI,pow from std

Effects of calls to Garbage Collector when using ARC/ORC?

2023-10-11 Thread lou15b
> you can use SDL2's event loop in Nim without any callbacks or threading > shenanigans Very true. That occurred to me overnight as well, it just requires revamping event handling in my nimx fork - which I was intending to do anyway as part of an attempt to eliminate reference loops in the View

Nim boilerplate

2023-10-11 Thread LokeX
Did you call the funcs?

Nim boilerplate

2023-10-11 Thread LokeX
Try this: const shapes = [ Circle:Shape(kind:Circle,r:10).buildCircleProps, Rectangle:Shape(kind:Rectangle,w:10,h:10).buildRectangleProps, ] Run

Nim boilerplate

2023-10-11 Thread Nerve
Projection.

Nim boilerplate

2023-10-11 Thread mashingan
I tried your example but commented out the "boilerplate" func defs and it compiled fine.

Nim boilerplate

2023-10-11 Thread LokeX
If you could produce a simple example, that would be helpful...

Nim boilerplate

2023-10-11 Thread LokeX
Troll

Nim boilerplate

2023-10-11 Thread cblake
Possibly more helpful to reduce boilerplate is with `template` as used, e.g. at the bottom of which is then used by the example program . (That is for new style `concept` whi

Nim boilerplate

2023-10-11 Thread LokeX
I don't think you get the point here. Think about it again - please...

Nim boilerplate

2023-10-11 Thread Nerve
The lengths to which people go to preserve extreme levels of OO abstraction and inheritance baffles me. I've found zero use for any of it in the real world. I'm going to be "that guy" and suggest that Nim's objects map to structs fairly closely for a reason, and that maybe learning to simplify y

Nim boilerplate

2023-10-11 Thread LokeX
More like completely irrelevant and typifying a person in some cult or other...

Nim boilerplate

2023-10-11 Thread aEverr
your concepts are wrong, saying that type CircleShape = concept a a.r buildCircleProps(a) Run means that for anything to match CircleShape, it must already have a buildCircleProps defined for it. if you do not want that, you remove the build() lines an

Nim boilerplate

2023-10-11 Thread LokeX
Don't get me wrong here: Nim concepts introduce wonderful advantages; squarely among them: 1. Compiletime type checking of object variants matching on fields (considering that the runtime produces no stack trace on field access errors - this is nice) 2. Go-lang like interfaces 3. Many mor

related_post_gen benchmark

2023-10-11 Thread cblake
> very few if any posts have 65..100 tags In fact, one can systematize based upon that to keep the hot-path memory footprint small by using 1 bit out of the 64 as an "overflow flag". So, e.g. up to 63 tags work with the bit-vector and the ones past that (64..100) are treated specially as done,

related_post_gen benchmark

2023-10-11 Thread cblake
(key concepts are triple-star bold-italic for your reading ease) @inv2004 \- fnv1 does byte-at-a-time processing which is slower compared to 8-byte at a time processing on modern CPUs just because there are many fewer loops. So, **_for example_** , here is a table I made { on just one CPU (i7-6

NimConf 2023

2023-10-11 Thread jmgomez
Im not sure what has to be done. I guess it's a matter of reviewing the submissions and updating the website. If you helped in the past @pmunch, probably you know better. FOSDEM is great but I bet there are people that wont attend that is willing to produce content for the NimConf. Myself inclu

related_post_gen benchmark

2023-10-11 Thread inv2004
I am from perf point of view. If you want to sum the ints after - you have the int and defer the ptr is not necessary

related_post_gen benchmark

2023-10-11 Thread Araq
> If return type is 'lent int' then lint can return just 'int', not 'addr int' I know but it's not required. The address of the location exists already as it's inside a hash table.

related_post_gen benchmark

2023-10-11 Thread inv2004
It is not about comparison with Rust. I am about “implicitly copyable” types. And I suppose lent can cover the types special way too (if not already). If return type is 'lent int' then lint can return just 'int', not 'addr int'

related_post_gen benchmark

2023-10-11 Thread Araq
> Deref can happen after it - when you want to extract value under the ref. > Maybe some specialization for the '[]' could help with it, but, maybe, it > should be responsibility of the lent - to avoid the optimization for int (BTW > - looks like Rust) What you say makes no sense. BTW: I don't

Pure Nim FFT library

2023-10-11 Thread didlybom
Arne, would it be possible for you to publish this library in the nimble directory? Currently you cannot just do `nimble install fftr`.

related_post_gen benchmark

2023-10-11 Thread inv2004
Deref can happen after it - when you want to extract value under the ref

related_post_gen benchmark

2023-10-11 Thread ringabout
I created a PR => for it should lent its return value. Though, I surmise it's more of cursor issues, which means `t[i mod 100]` might create an unnecessary temporary.

related_post_gen benchmark

2023-10-11 Thread Araq
Whether it creates an additional deref or not is hard to say. In principle it doesn't as the hash table skips the deref as only the address of the value is requested.

related_post_gen benchmark

2023-10-11 Thread inv2004
How the 'lent' works if table's value is something simple like int? Because if it creates addr of the int - it will create additional deref which is not necessary for the primitive type

related_post_gen benchmark

2023-10-11 Thread ringabout
> PRs are welcome. On it

NimConf 2023

2023-10-11 Thread xigoi
Surely you mean “Nimi Conf”.

related_post_gen benchmark

2023-10-11 Thread Araq
Been there, done that, doesn't work and affects type compatibility with proc types too.