<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div id="yiv1411723712"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt;">Some new exciting information...I ran the create-mat function a million times and my memory went up a slight bit,  I ran a million more and it went up a gain..I ran a million more and it actually leveled off. After running a million more times it actually started going down.  I was able to see the Lisp GC at work...It doesn't seem to kick in until memory becomes an issue, again sir ...it was an honor<br clear="none"><div id="yiv1411723712yui_3_13_0_12_1398512961307_8"><span id="yiv1411723712yui_3_13_0_12_1398512961307_15"><br clear="none"></span></div><div class="yiv1411723712yqt0895340965"
 id="yiv1411723712yqt74208"><div class="yiv1411723712yahoo_quoted" id="yiv1411723712yui_3_13_0_12_1398512961307_10" style="display: block;"> <div class="yiv1411723712yui_3_13_0_1_1398512961307_14903" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt;"> <div class="yiv1411723712yui_3_13_0_1_1398512961307_14904" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;"> <div dir="ltr"> <font face="Arial" size="2"> On Saturday, April 26, 2014 4:24 AM, Willem Rein Oudshoorn <woudshoo@xs4all.nl> wrote:<br clear="none"> </font> </div> <blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;margin-top:5px;padding-left:5px;">  <div class="yiv1411723712y_msg_container">Joeish W <<a rel="nofollow" shape="rect" ymailto="mailto:joeish80829@yahoo.com" target="_blank"
 href="mailto:joeish80829@yahoo.com">joeish80829@yahoo.com</a>> writes:<br clear="none"><br clear="none"><br clear="none">> (defcfun ("cv_create_Mat" create-mat) (%cv-mat :garbage-collect t))<br clear="none">><br clear="none">> a million times to bench mark it it was actually 4 times slower than<br clear="none">> my original code....I really do need this all to be fast code, since<br clear="none">> computer vision  can benefit from the speed.  Also I noticed when I<br clear="none">> ran the (create-mat) function 1,000,000
 times my ram went up a tiny<br clear="none">> bit and didn't go down..Is that normal for finalizers.<br clear="none"><br clear="none">Well, that it is a bit slower is not really surprising because:<br clear="none"><br clear="none">1. CLOS classes are instantatied to wrap the pointer <br clear="none">2. The trivial garbage needs to keep track of the objects<br clear="none">3. The conversion code is done by generic functions.<br clear="none"><br clear="none">However, this is solvable.  But I really would not focus on this right<br clear="none">now.  I cannot really imagine that creating the matrix is the<br clear="none">bottleneck.  <br clear="none"><br clear="none">With respect to the memory, as long as it does not grow indefinitely I<br clear="none">would not worry about it.  The trivial garbage package might introduce<br clear="none">some memory overhead which is not directly reclaimed by the garbage<br
 clear="none">collector.  <br clear="none"><br clear="none"><br clear="none">> When I use<br clear="none">> with-* macros or manual MM I don't get an increase in ram on my<br clear="none">> system.  I would like to include finalizers in my library but is there<br clear="none">> any way to
 overcome these obstacles to make that happen...Again the<br clear="none">> time you took to help me on this is much appreciated. :)You really<br clear="none">> helped me to understand.<br clear="none"><br clear="none">Using `with-*` macros is a good idea.  Inside these macros you can<br clear="none">do the manual garbage collection and avoid maybe the generic type<br clear="none">conversion.    But to make it robust the `with-*` macros will not (I<br clear="none">expect) be faster than the code you have now.  <br clear="none"><br clear="none">Making the code fast is certainly doable and not hard, but you should<br clear="none">first make it work and figure what needs to be fast and which<br clear="none">conveniences you are willing to give up for the speed improvement.<br clear="none"><br clear="none">Wim Oudshoorn<br clear="none"><br clear="none"><br clear="none">_______________________________________________<br
 clear="none">Cffi-devel mailing list<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:Cffi-devel@common-lisp.net" target="_blank" href="mailto:Cffi-devel@common-lisp.net">Cffi-devel@common-lisp.net</a><br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel">http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel</a><br clear="none"><br clear="none"><br clear="none"></div> </blockquote>  </div> </div>   </div></div> </div></div></div></div></body></html>