ts,level,bytes 형식으로 생성한 약 200만 줄에 대해 try parseLine(line)과 parseLine(line) catch unreachable의 시간을 재고 있어요. bytes를 합산하고요. -Doptimize=ReleaseFast로 빌드했어요.
try 쪽은 수백 마이크로초가 나오고, 합계 대신 에러 이름이 출력돼요. catch unreachable 쪽은 수십 ms가 걸리고 합계도 달라요. 두 번째 쪽은 ReleaseSafe와 Debug에서 panic이 나요. "현실적으로 만들려고" 5000줄마다 깨진 줄을 하나씩 넣었어요. --bad-every 0이면 좀 정상으로 보이는데, 왜 이렇게까지 차이가 나는지 모르겠어요.
두 루프는 이래요:
const e = try parse.parseLine(line);
total += e.bytes;
// vs
const e = parse.parseLine(line) catch unreachable;
total += e.bytes;
제 추측은 error return trace나 인라이닝이었어요. 어셈블리는 아직 안 봤어요. 입력 생성은 이미 타이머 밖에 있어요. (splitScalar가 0.12 즈음에 나온 것 같은데, 틀렸으면 무시하세요.)
그래서 이게 실제로 뭘 측정하는 걸까요? 조언 주시면 감사하겠어요.
영어에서 번역·원문 보기I'm timing try parseLine(line) against parseLine(line) catch unreachable over ~2M generated ts,level,bytes lines, summing the bytes. Built with -Doptimize=ReleaseFast.
The try run reports a few hundred microseconds and prints an error name instead of a total. The catch unreachable run takes tens of ms, and its total is different. ReleaseSafe and Debug panic on the second one. I added a corrupt line every 5000 lines to "make it realistic". With --bad-every 0 things look saner, but I don't get why it matters this much.
The two loops:
const e = try parse.parseLine(line);
total += e.bytes;
// vs
const e = parse.parseLine(line) catch unreachable;
total += e.bytes;
My guesses were error return traces or inlining. I haven't looked at the assembly yet. Input generation is already outside the timer. (splitScalar showed up around 0.12, I think, nvm if that's off.)
So what is this actually measuring? Thanks for any pointers.