A microbenchmarking library

2018-08-20 Thread lemonboy
Dear Nimmers, [Here's](https://github.com/LemonBoy/criterion.nim) a nice little library for all your microbenchmarking needs. Benchmarking is hard and the aim of this library is to abstract away most of the complexity and pitfalls and provide the user (hopefully) meaningful results. I

Re: A microbenchmarking library

2018-08-20 Thread lemonboy
That's now fixed! Thanks for the heads up!

Re: These Lemire Benchmarks are really nice

2018-08-23 Thread lemonboy
> I have no idea how he gets the exact cycle count By using the rdtsc instruction on x86/x64 CPUs (see [here](https://www.felixcloutier.com/x86/RDTSC.html) for more details). If you're looking for benchmarking solutions check out [this](https://github.com/LemonBoy/criterion.nim) lib too :)

Re: These Lemire Benchmarks are really nice

2018-08-24 Thread lemonboy
I've just finished implementing it (at least for x64) :)

Re: A microbenchmarking library

2018-08-25 Thread lemonboy
> The example output on your github page is still wrong, the cycles count is > much too high. Is it? I've probably benchmarked it without the release switch. As usual beware of the optimizer, make sure the benchmark function doesn't elide the comparison completely. Introducing an argument using

Re: A microbenchmarking library

2018-08-26 Thread lemonboy
Oh I see what you mean. As usual one must be smart enough to set the CPU governor to 'performance' and pin the benchmarking thread to a single core to prevent measuring errors due to SMP migration. Benchmarking is twice as hard as writing code :)

Re: Using fields to define other fields

2018-08-26 Thread lemonboy
If the size is known at compile time you may make size a static[int] parameter for the object. Otherwise you should drop the array altogether and use a preallocated seq.

Re: Using fields to define other fields

2018-08-26 Thread lemonboy
Since the size is part of the type you can easily extract it with this completely untested piece of code that should hopefully work: proc size1[N](x: Object[N]): int = N Run

Re: Can't connect to abstract unix socket

2018-09-15 Thread lemonboy
Thanks for the report, I've pushed a fix [here](https://github.com/nim-lang/Nim/pull/8977). Please checks if it solves the problem for you.

A fast float to string conversion library

2018-09-25 Thread lemonboy
seful for serialization-heavy workflows. You can grab it [here](https://github.com/LemonBoy/dtoa.nim).

Re: A fast float to string conversion library

2018-09-26 Thread lemonboy
The underlying algorithm is nothing more than `grisu2` that's going to give you roundtrip-able values in the shortest amount of time, the tradeoff is in the 0.05% of numbers that cannot be "encoded" in the shortest possible way. For a stdlib implementation you may want to use something like `err

Re: A microbenchmarking library

2018-10-02 Thread lemonboy
Good news, criterion is now available on nimble! I also need your help, if you're on Windows or OSX can you please check if the `tfib.nim` example runs fine for you? I tried setting up Travis to run the test suite on OSX too but got a timeout after 10m so either the timing code is wrong for tha

Re: A microbenchmarking library

2018-10-02 Thread lemonboy
2 minutes top on a very busy machine. I guess there's something wrong in the `getMonotonicTime` implementation for OSX then... What is the computed `scaleFactor` in `timer.nim` ?

Re: A microbenchmarking library

2018-10-02 Thread lemonboy
Thanks to @dm1try latest PR it now works fine on OSX!

Cassette - A HTTP mocking library

2019-01-28 Thread lemonboy
Hello people, I've just released **cassette** in its initial form, you can find it [here](https://github.com/LemonBoy/cassette). This library lets you record & replay your HTTP interactions with a remote server and is really useful if you want to make your tests deterministic (and fa

Re: no "--opt:size" leads EXE to "SIGSEGV: Illegal storage access. (Attempt to read from nil?)"

2019-02-02 Thread lemonboy
First things first, I'm able to run your program without `--opt:size` after some minor modifications. You're building a `wxListItem` incorrectly since you specify too few masks and the width and format you specify are ignored: see [here](https://github.com/wxWidgets/wxWidgets/blob/cc931612eec2e

Re: Unexpected async behaviour?

2019-02-12 Thread lemonboy
It's not a bug, it's a feature :) You probably missed [this](https://nim-lang.github.io/Nim/manual.html#closures-creating-closures-in-loops) part of the manual where it is explained that closures capture variable by reference. In your example the inner `serve` captures `c` by reference and, as

Re: ptr arithmetics?

2019-02-15 Thread lemonboy
Easy as cake type UDP_packet = object port_src: uint16 port_dst: uint16 length: uint16 chksum: uint16 data: UncheckedArray[byte] Run > It won't print nicely though Yeah, the compiler-generated `$`