[Ffmpeg-devel] [PATCH 8/9] Doxygenize av_fast_realloc comments

Panagiotis Issaris takis
Thu Feb 22 22:32:31 CET 2007


Hi Michael,

Panagiotis Issaris schreef:
> Michael Niedermayer schreef:
>> On Thu, Feb 22, 2007 at 08:47:58PM +0100, Panagiotis Issaris wrote:
[...]
>>>> additionally, this function is a internal function of avcodec
>>>> and should not be used outside, it shouldnt have a av_ prefix  but ff_
>>>> and it should be droped if normal av_realloc() is as fast (benchmark a
>>>> large number of reallocs)
>>>>  
>>>>       
>>> I?ll first prepare a patch for moving it and doing the s/av/ff/ 
>>> thing. Afterwards I'll post
>>> some benchmarking code so that others correct it and run the 
>>> benchmark too.
>>>     
>>
>> hmm wouldnt it be better to benchmark it first before doing a possibly
>> redundant move/rename patch?
>>   
> Yes, but I thought it might take a while till consensus is reached on 
> whether it is faster or not, and
> that it might also take awhile before it gets benchmarked on enough 
> different architectures/CPUs.
A first attempt of some benchmarking code for av_fast_realloc() 
hideously embedded within FFmpeg's main function.

I do not know if I'm benchmarking the correct type of usage of 
av_fast_realloc() vs av_realloc() nor if I am using
START_TIMER|STOP_TIMER in the way you had intended it...

For each test of av_fast_realloc() I tested two runs, one with 
size<min_size and one with size>min_size, to test both
cases. (Besides the obvious av_realloc() run ofcourse.)

_Obviously_ not intended for Subversion.

 ffmpeg.c |  139 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 139 insertions(+)

takis at poseidon:/usr/local/src/ffmpeg-pi$  ./ffmpeg
3680 dezicycles in av_fast_realloc same size (min_size==200), 1 runs, 0 
skips
2080 dezicycles in av_fast_realloc same size (min_size==200), 2 runs, 0 
skips
1120 dezicycles in av_fast_realloc same size (min_size==200), 4 runs, 0 
skips
640 dezicycles in av_fast_realloc same size (min_size==200), 8 runs, 0 skips
400 dezicycles in av_fast_realloc same size (min_size==200), 16 runs, 0 
skips
280 dezicycles in av_fast_realloc same size (min_size==200), 32 runs, 0 
skips
220 dezicycles in av_fast_realloc same size (min_size==200), 64 runs, 0 
skips
190 dezicycles in av_fast_realloc same size (min_size==200), 128 runs, 0 
skips
175 dezicycles in av_fast_realloc same size (min_size==200), 256 runs, 0 
skips
167 dezicycles in av_fast_realloc same size (min_size==200), 512 runs, 0 
skips
164 dezicycles in av_fast_realloc same size (min_size==200), 1024 runs, 
0 skips
162 dezicycles in av_fast_realloc same size (min_size==200), 2048 runs, 
0 skips
161 dezicycles in av_fast_realloc same size (min_size==200), 4096 runs, 
0 skips
160 dezicycles in av_fast_realloc same size (min_size==200), 8192 runs, 
0 skips
160 dezicycles in av_fast_realloc same size (min_size==200), 16384 runs, 
0 skips
160 dezicycles in av_fast_realloc same size (min_size==200), 32768 runs, 
0 skips
160 dezicycles in av_fast_realloc same size (min_size==200), 65536 runs, 
0 skips
29340 dezicycles in av_fast_realloc same size (min_size==2000), 1 runs, 
0 skips
15520 dezicycles in av_fast_realloc same size (min_size==2000), 2 runs, 
0 skips
8375 dezicycles in av_fast_realloc same size (min_size==2000), 4 runs, 0 
skips
4746 dezicycles in av_fast_realloc same size (min_size==2000), 8 runs, 0 
skips
2948 dezicycles in av_fast_realloc same size (min_size==2000), 16 runs, 
0 skips
2019 dezicycles in av_fast_realloc same size (min_size==2000), 32 runs, 
0 skips
1554 dezicycles in av_fast_realloc same size (min_size==2000), 64 runs, 
0 skips
1324 dezicycles in av_fast_realloc same size (min_size==2000), 128 runs, 
0 skips
1210 dezicycles in av_fast_realloc same size (min_size==2000), 256 runs, 
0 skips
1152 dezicycles in av_fast_realloc same size (min_size==2000), 512 runs, 
0 skips
1122 dezicycles in av_fast_realloc same size (min_size==2000), 1024 
runs, 0 skips
1106 dezicycles in av_fast_realloc same size (min_size==2000), 2048 
runs, 0 skips
1098 dezicycles in av_fast_realloc same size (min_size==2000), 4096 
runs, 0 skips
1094 dezicycles in av_fast_realloc same size (min_size==2000), 8192 
runs, 0 skips
1092 dezicycles in av_fast_realloc same size (min_size==2000), 16383 
runs, 1 skips
1091 dezicycles in av_fast_realloc same size (min_size==2000), 32767 
runs, 1 skips
1090 dezicycles in av_fast_realloc same size (min_size==2000), 65533 
runs, 3 skips
29440 dezicycles in av_realloc same size, 1 runs, 0 skips
15305 dezicycles in av_realloc same size, 2 runs, 0 skips
8142 dezicycles in av_realloc same size, 4 runs, 0 skips
4553 dezicycles in av_realloc same size, 8 runs, 0 skips
2776 dezicycles in av_realloc same size, 16 runs, 0 skips
1865 dezicycles in av_realloc same size, 32 runs, 0 skips
1408 dezicycles in av_realloc same size, 64 runs, 0 skips
1183 dezicycles in av_realloc same size, 128 runs, 0 skips
1070 dezicycles in av_realloc same size, 256 runs, 0 skips
1011 dezicycles in av_realloc same size, 512 runs, 0 skips
981 dezicycles in av_realloc same size, 1024 runs, 0 skips
966 dezicycles in av_realloc same size, 2048 runs, 0 skips
958 dezicycles in av_realloc same size, 4096 runs, 0 skips
954 dezicycles in av_realloc same size, 8192 runs, 0 skips
952 dezicycles in av_realloc same size, 16384 runs, 0 skips
951 dezicycles in av_realloc same size, 32768 runs, 0 skips
950 dezicycles in av_realloc same size, 65535 runs, 1 skips
61010 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 1 runs, 0 skips
34755 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 2 runs, 0 skips
20285 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 4 runs, 0 skips
11621 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 8 runs, 0 skips
6818 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 16 runs, 0 skips
4437 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 32 runs, 0 skips
2979 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 64 runs, 0 skips
2086 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 128 runs, 0 skips
1435 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 256 runs, 0 skips
800 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 512 runs, 0 skips
481 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 1024 runs, 0 skips
320 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 2048 runs, 0 skips
240 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 4096 runs, 0 skips
200 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 8192 runs, 0 skips
180 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 16384 runs, 0 skips
170 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 32768 runs, 0 skips
165 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==200), 65536 runs, 0 skips
41010 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 1 runs, 0 skips
28250 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 2 runs, 0 skips
16812 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 4 runs, 0 skips
9970 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 8 runs, 0 skips
6052 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 16 runs, 0 skips
3823 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 32 runs, 0 skips
2636 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 64 runs, 0 skips
1926 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 128 runs, 0 skips
1545 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 256 runs, 0 skips
1346 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 512 runs, 0 skips
1224 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 1024 runs, 0 skips
1135 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 2048 runs, 0 skips
647 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 4096 runs, 0 skips
404 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 8192 runs, 0 skips
282 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 16384 runs, 0 skips
221 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 32768 runs, 0 skips
190 dezicycles in av_fast_realloc increasing size starting from 0 
(min_size==2000), 65536 runs, 0 skips
38990 dezicycles in av_realloc increasing size starting from 0, 1 runs, 
0 skips
23625 dezicycles in av_realloc increasing size starting from 0, 2 runs, 
0 skips
13972 dezicycles in av_realloc increasing size starting from 0, 4 runs, 
0 skips
8320 dezicycles in av_realloc increasing size starting from 0, 8 runs, 0 
skips
5174 dezicycles in av_realloc increasing size starting from 0, 16 runs, 
0 skips
3338 dezicycles in av_realloc increasing size starting from 0, 32 runs, 
0 skips
2287 dezicycles in av_realloc increasing size starting from 0, 64 runs, 
0 skips
1698 dezicycles in av_realloc increasing size starting from 0, 128 runs, 
0 skips
1371 dezicycles in av_realloc increasing size starting from 0, 256 runs, 
0 skips
1193 dezicycles in av_realloc increasing size starting from 0, 512 runs, 
0 skips
1097 dezicycles in av_realloc increasing size starting from 0, 1024 
runs, 0 skips
1045 dezicycles in av_realloc increasing size starting from 0, 2048 
runs, 0 skips
1017 dezicycles in av_realloc increasing size starting from 0, 4096 
runs, 0 skips
1002 dezicycles in av_realloc increasing size starting from 0, 8191 
runs, 1 skips
994 dezicycles in av_realloc increasing size starting from 0, 16381 
runs, 3 skips
991 dezicycles in av_realloc increasing size starting from 0, 32761 
runs, 7 skips
988 dezicycles in av_realloc increasing size starting from 0, 65521 
runs, 15 skips
15950 dezicycles in av_fast_realloc increasing size (min_size==200), 1 
runs, 0 skips
8445 dezicycles in av_fast_realloc increasing size (min_size==200), 2 
runs, 0 skips
4547 dezicycles in av_fast_realloc increasing size (min_size==200), 4 
runs, 0 skips
2476 dezicycles in av_fast_realloc increasing size (min_size==200), 8 
runs, 0 skips
1366 dezicycles in av_fast_realloc increasing size (min_size==200), 16 
runs, 0 skips
780 dezicycles in av_fast_realloc increasing size (min_size==200), 32 
runs, 0 skips
478 dezicycles in av_fast_realloc increasing size (min_size==200), 64 
runs, 0 skips
323 dezicycles in av_fast_realloc increasing size (min_size==200), 128 
runs, 0 skips
243 dezicycles in av_fast_realloc increasing size (min_size==200), 256 
runs, 0 skips
203 dezicycles in av_fast_realloc increasing size (min_size==200), 512 
runs, 0 skips
182 dezicycles in av_fast_realloc increasing size (min_size==200), 1024 
runs, 0 skips
171 dezicycles in av_fast_realloc increasing size (min_size==200), 2048 
runs, 0 skips
165 dezicycles in av_fast_realloc increasing size (min_size==200), 4096 
runs, 0 skips
163 dezicycles in av_fast_realloc increasing size (min_size==200), 8192 
runs, 0 skips
161 dezicycles in av_fast_realloc increasing size (min_size==200), 16384 
runs, 0 skips
160 dezicycles in av_fast_realloc increasing size (min_size==200), 32768 
runs, 0 skips
160 dezicycles in av_fast_realloc increasing size (min_size==200), 65536 
runs, 0 skips
39410 dezicycles in av_fast_realloc increasing size (min_size==2000), 1 
runs, 0 skips
24105 dezicycles in av_fast_realloc increasing size (min_size==2000), 2 
runs, 0 skips
14505 dezicycles in av_fast_realloc increasing size (min_size==2000), 4 
runs, 0 skips
8748 dezicycles in av_fast_realloc increasing size (min_size==2000), 8 
runs, 0 skips
5372 dezicycles in av_fast_realloc increasing size (min_size==2000), 16 
runs, 0 skips
3459 dezicycles in av_fast_realloc increasing size (min_size==2000), 32 
runs, 0 skips
2402 dezicycles in av_fast_realloc increasing size (min_size==2000), 64 
runs, 0 skips
1809 dezicycles in av_fast_realloc increasing size (min_size==2000), 128 
runs, 0 skips
1473 dezicycles in av_fast_realloc increasing size (min_size==2000), 256 
runs, 0 skips
1292 dezicycles in av_fast_realloc increasing size (min_size==2000), 512 
runs, 0 skips
1173 dezicycles in av_fast_realloc increasing size (min_size==2000), 
1024 runs, 0 skips
667 dezicycles in av_fast_realloc increasing size (min_size==2000), 2048 
runs, 0 skips
414 dezicycles in av_fast_realloc increasing size (min_size==2000), 4096 
runs, 0 skips
287 dezicycles in av_fast_realloc increasing size (min_size==2000), 8192 
runs, 0 skips
223 dezicycles in av_fast_realloc increasing size (min_size==2000), 
16384 runs, 0 skips
191 dezicycles in av_fast_realloc increasing size (min_size==2000), 
32768 runs, 0 skips
175 dezicycles in av_fast_realloc increasing size (min_size==2000), 
65536 runs, 0 skips
52040 dezicycles in av_realloc increasing size, 1 runs, 0 skips
30050 dezicycles in av_realloc increasing size, 2 runs, 0 skips
18357 dezicycles in av_realloc increasing size, 4 runs, 0 skips
11070 dezicycles in av_realloc increasing size, 8 runs, 0 skips
7110 dezicycles in av_realloc increasing size, 16 runs, 0 skips
4427 dezicycles in av_realloc increasing size, 32 runs, 0 skips
2830 dezicycles in av_realloc increasing size, 64 runs, 0 skips
1961 dezicycles in av_realloc increasing size, 128 runs, 0 skips
1533 dezicycles in av_realloc increasing size, 256 runs, 0 skips
1257 dezicycles in av_realloc increasing size, 511 runs, 1 skips
1129 dezicycles in av_realloc increasing size, 1023 runs, 1 skips
1056 dezicycles in av_realloc increasing size, 2047 runs, 1 skips
1018 dezicycles in av_realloc increasing size, 4095 runs, 1 skips
999 dezicycles in av_realloc increasing size, 8191 runs, 1 skips
988 dezicycles in av_realloc increasing size, 16383 runs, 1 skips
982 dezicycles in av_realloc increasing size, 32767 runs, 1 skips
979 dezicycles in av_realloc increasing size, 65535 runs, 1 skips
46270 dezicycles in av_fast_realloc (big) increasing size 
(min_size=100), 1 runs, 0 skips
23485 dezicycles in av_fast_realloc (big) increasing size 
(min_size=100), 2 runs, 0 skips
12010 dezicycles in av_fast_realloc (big) increasing size 
(min_size=100), 4 runs, 0 skips
6180 dezicycles in av_fast_realloc (big) increasing size (min_size=100), 
8 runs, 0 skips
3207 dezicycles in av_fast_realloc (big) increasing size (min_size=100), 
16 runs, 0 skips
1704 dezicycles in av_fast_realloc (big) increasing size (min_size=100), 
32 runs, 0 skips
945 dezicycles in av_fast_realloc (big) increasing size (min_size=100), 
64 runs, 0 skips
561 dezicycles in av_fast_realloc (big) increasing size (min_size=100), 
128 runs, 0 skips
367 dezicycles in av_fast_realloc (big) increasing size (min_size=100), 
256 runs, 0 skips
270 dezicycles in av_fast_realloc (big) increasing size (min_size=100), 
512 runs, 0 skips
220 dezicycles in av_fast_realloc (big) increasing size (min_size=100), 
1024 runs, 0 skips
195 dezicycles in av_fast_realloc (big) increasing size (min_size=100), 
2048 runs, 0 skips
182 dezicycles in av_fast_realloc (big) increasing size (min_size=100), 
4096 runs, 0 skips
176 dezicycles in av_fast_realloc (big) increasing size (min_size=100), 
8192 runs, 0 skips
173 dezicycles in av_fast_realloc (big) increasing size (min_size=100), 
16384 runs, 0 skips
171 dezicycles in av_fast_realloc (big) increasing size (min_size=100), 
32768 runs, 0 skips
170 dezicycles in av_fast_realloc (big) increasing size (min_size=100), 
65536 runs, 0 skips
27280 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 1 runs, 0 skips
18270 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 2 runs, 0 skips
11785 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 4 runs, 0 skips
7352 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 8 runs, 0 skips
4661 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 16 runs, 0 skips
3082 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 32 runs, 0 skips
2196 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 64 runs, 0 skips
1692 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 128 runs, 0 skips
1411 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 256 runs, 0 skips
1254 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 512 runs, 0 skips
1169 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 1024 runs, 0 skips
1123 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 2048 runs, 0 skips
1098 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 4096 runs, 0 skips
1085 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 8192 runs, 0 skips
1078 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 16384 runs, 0 skips
719 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 32768 runs, 0 skips
439 dezicycles in av_fast_realloc (big) increasing size 
(min_size=40000), 65536 runs, 0 skips
185730 dezicycles in av_realloc (big) increasing size, 1 runs, 0 skips
105655 dezicycles in av_realloc (big) increasing size, 2 runs, 0 skips
59335 dezicycles in av_realloc (big) increasing size, 4 runs, 0 skips
35182 dezicycles in av_realloc (big) increasing size, 8 runs, 0 skips
19332 dezicycles in av_realloc (big) increasing size, 16 runs, 0 skips
10413 dezicycles in av_realloc (big) increasing size, 32 runs, 0 skips
5983 dezicycles in av_realloc (big) increasing size, 64 runs, 0 skips
3624 dezicycles in av_realloc (big) increasing size, 128 runs, 0 skips
2393 dezicycles in av_realloc (big) increasing size, 256 runs, 0 skips
1709 dezicycles in av_realloc (big) increasing size, 512 runs, 0 skips
1355 dezicycles in av_realloc (big) increasing size, 1024 runs, 0 skips
1166 dezicycles in av_realloc (big) increasing size, 2047 runs, 1 skips
1074 dezicycles in av_realloc (big) increasing size, 4095 runs, 1 skips
1025 dezicycles in av_realloc (big) increasing size, 8190 runs, 2 skips
1000 dezicycles in av_realloc (big) increasing size, 16381 runs, 3 skips
988 dezicycles in av_realloc (big) increasing size, 32765 runs, 3 skips
982 dezicycles in av_realloc (big) increasing size, 65531 runs, 5 skips
takis at poseidon:/usr/local/src/ffmpeg-pi$


With friendly regards,
Takis

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pi-20070222T223032-ffmpeg-benchmark_av_fast_realloc.diff
Type: text/x-patch
Size: 4424 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070222/edd6d4ba/attachment.bin>



More information about the ffmpeg-devel mailing list