Re: Vapoursynth - optimization

2020-04-03 Thread mantielero
It has improved a bit. Regarding the Nim filter: * 308fps by tuning seq[seq[int]], into array[9,int32] * 442fps by changing the bound checks into min( max(val, 0), max_val) Still slow but getting better. import ../vapoursynth import math template clamp(val:int,

Re: Vapoursynth - optimization

2020-04-03 Thread mratsim
This is the source of your slowness let kernel = @[@[1, 2, 1], @[2, 4, 2], @[1, 2, 1] ] Run Instead you should use let kernel = [[1, 2, 1], [2, 4, 2], [1, 2, 1]] Run

Re: Vapoursynth - optimization

2020-04-03 Thread mantielero
**Working with C filters** When I work with C filters (like Convolution) I works fine with refc GC. In that case, I don't know why I get 2640fps vs 3740fps on the python version. They should be roughly the same. When I call a filter within an existing plugin I just call one function:

Re: Vapoursynth - optimization

2020-04-02 Thread Stefan_Salewski
> At this stage I can only recommend NOT to use VapourSynth.nim. It is too slow Please note that your first task would be to make it work with default refc GC and with arc GC. \--gc:none was only suggested for tests, as you reported that it crash with refc GC.| ---|--- For performance

Re: Vapoursynth - optimization

2020-04-02 Thread mantielero
At this stage I can only recommend NOT to use VapourSynth.nim. It is too slow (not because of nim, but I cannot find out why). Testing the convolution filter in Python: import vapoursynth as vs core = vs.get_core() core.std.SetMaxCPU('none') clip =

Re: Vapoursynth - optimization

2020-03-31 Thread doofenstein
I would prefer UncheckedArray, since it's integrated directly into Nim and also because I personally it's semantics. If you want to expose an API in a safer way UncheckedArrays also have the advantage that they can be

Re: Vapoursynth - optimization

2020-03-31 Thread mantielero
Let me try asking less general questions: What is preferred, using UncheckedArray, using [these templates](https://forum.nim-lang.org/t/1188#7366)? I guess all this is better than performing a memcopy into a Nim structure.

Vapoursynth - optimization

2020-03-30 Thread mantielero
My filters are unsurprisingly slow (because of the "My" variable, of course). Now I would like to learn how to avoid that. I have implemented a Gauss filter just to compare it with a C++ version . The results are 80fps (for me) against about 2400fps for a C++ wrapper and 11748fps for a pure C

Re: Vapoursynth - optimization

2020-03-30 Thread mantielero
Just for the record the C++ version is [here](https://github.com/IFeelBloated/vsFilterScript/blob/master/GaussBlur.hxx#L23) using templates. And this is by using the [low level API](https://github.com/IFeelBloated/test_c_filters/blob/master/GaussBlur.cxx#L26).