Iterators dont inline

2024-06-23 Thread 4n0n4me
{ { NI i; NI res; i = (NI)0; res = ((NI)1); { while (1) {

Iterators dont inline

2024-06-21 Thread Kajalishu
Who knows what you are measuring.

Iterators dont inline

2024-06-21 Thread blackmius
ok, bad example. why then my first JsonNode example also shows worse perfomance when there is additional iterator in between? JsonNode as i know is ref JsonNodeObj so there should not be a copy

Iterators dont inline

2024-06-20 Thread Araq
Who knows what you are measuring.

Iterators dont inline

2024-06-19 Thread blackmius
is it not enabled by default when compiled with -d:release -d:danger?

Iterators dont inline

2024-06-19 Thread Araq
Inlining is not the same as copy elision, these iterators are inlined. Also, turn on the optimizer.

Iterators dont inline

2024-06-19 Thread blackmius
Found that use of iterator which just extend field is cost additional computation time (about 20% time more) nim import std/[json, times, monotimes, tables] let a = %*{"a": 1, "b": 2, "c": 3} var start = getMonoTime() for i in 1..1_000_000: for k, v in a.f

Iterators dont inline

2024-06-19 Thread blackmius
have managed to simplify type A = object a: int b: int iterator q1(): A = for i in 1..1_000_000: yield A(a: i) iterator q2(): A = for i in q1(): yield i var b = 0 start = getMonoTime() for i in q1(): b += i

Iterators dont inline

2024-06-19 Thread blackmius
have managed to simplify type A = object a: int b: int iterator q1(): A = for i in 1..1_000_000: yield A(a: i) iterator q2(): A = for i in q1(): yield i var b = 0 start = getMonoTime() for i in q1(): b += i