On Thu, Jan 13, 2011 at 8:31 PM, Harry Spier <span dir="ltr">&lt;<a href="mailto:vasishtha.spier@gmail.com">vasishtha.spier@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Dear list members,<br><br>Thank you for this.  3 x C should be efficient enough.<br><br></blockquote><div><br>Just to be sure I was clear: 3x C is something I&#39;ve done only for certain loops (a 1d convolution, in fact); I think that there are other loops that can do that, but you should try to find some core loop to try it out yourself.<br>
 </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">I am thinking that Racket would be an ideal choice for the OCR application for the following reasons:<br>
1) 3 x C efficiency for tight loops should be good enough (far better than Ruby)<br>
2) interface to ImageMagick (which I use to create my binary page representation)<br>3) I&#39;ve already done a fair bit of development of the application in Ruby (but its far too slow). But the constructs in Ruby that made it attractive are (I&#39;ve been told) functional programming constructs or copied from lisp type languages.<br>

4) Since I&#39;m new to lisp like languages,  I&#39;m enjoying learning a new programming paradigm.<br><br>My only concern now is about &quot;backward compatability&quot; as Racket develops.  I.e. if I develop my software package now, do I have to worry that as time goes on my program will no longer be compatable with the new versions of Racket?
  </blockquote><div><br>We do our best to maintain backwards compatibility (especially for core language features).<br><br>Robby<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Thanks again,<br><font color="#888888">Harry Spier</font><div><div></div><div class="h5"><br><br><div style="display: block;" class="gmail_quote">On Thu, Jan 13, 2011 at 5:55 PM, Matthias Felleisen <span dir="ltr">&lt;<a href="mailto:matthias@ccs.neu.edu" target="_blank">matthias@ccs.neu.edu</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br>
And it is easy to drop down to the C level with Eli&#39;s FFI.<br>
<div><div></div><div><br>
<br>
On Jan 13, 2011, at 5:54 PM, Robby Findler wrote:<br>
<br>
&gt; It is going to be hard to beat C. My experience is that on tight<br>
&gt; nested loops like that where the loop body is simple and you write the<br>
&gt; loop carefully you can get with 3x of C (or 2x since Matthew has<br>
&gt; improved things since I last tried) but it is difficult to get to that<br>
&gt; point.<br>
&gt;<br>
&gt; Of course, if you want to actually write a real program around your<br>
&gt; loop, then Racket is definitely a good choice. Also, if your loop is<br>
&gt; parallelizable, you might want to try using futures.<br>
&gt;<br>
&gt; In any case, a lot of these little core loops don&#39;t take too much time<br>
&gt; to write, so you might try writing it a few times in a few languages<br>
&gt; to see what you see.<br>
&gt;<br>
&gt; Robby<br>
&gt;<br>
&gt; On Thu, Jan 13, 2011 at 4:07 PM, Harry Spier &lt;<a href="mailto:harryspier@hotmail.com" target="_blank">harryspier@hotmail.com</a>&gt; wrote:<br>
&gt;&gt; Dear list members,<br>
&gt;&gt;<br>
&gt;&gt; I am developing an OCR application.  If written in an imperative language (<br>
&gt;&gt; C for example) it would spend most of its time traversing a 2 dimensional<br>
&gt;&gt; array. (I&#39;m representing a black and white page of text as a rectangle of<br>
&gt;&gt; 0&#39;s and 1&#39;s).  My first idea was to prototype in Ruby and then convert to C<br>
&gt;&gt; or to develop in Ruby with C extensions, but I&#39;m wondering if I could do the<br>
&gt;&gt; whole development in Racket.  I&#39;ve seen somewhere (though I can&#39;t remember<br>
&gt;&gt; where) that Racket can be in the same order of efficiency as C .<br>
&gt;&gt;<br>
&gt;&gt; But the crux issue is the efficiency of traversing the 2 dimensional array.<br>
&gt;&gt; I&#39;ve noticed in the Racket Guide section 18.7  &quot;Unchecked, Unsafe<br>
&gt;&gt; Operations&quot; where it says &quot;For tight loops that use these functions,<br>
&gt;&gt; avoiding checks can sometimes speed the computation, though the benefits<br>
&gt;&gt; vary for different unchecked functions and different contexts.&quot;<br>
&gt;&gt;<br>
&gt;&gt; Have any list members ever compared the efficiency of nested C loops and how<br>
&gt;&gt; you would traverse a 2 dimensional array in Racket.<br>
&gt;&gt;<br>
&gt;&gt; Thanks in advance,<br>
&gt;&gt; Harry Spier<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _________________________________________________<br>
&gt;&gt;  For list-related administrative tasks:<br>
&gt;&gt;  <a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br>
&gt;&gt;<br>
&gt; _________________________________________________<br>
&gt;  For list-related administrative tasks:<br>
&gt;  <a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br>
<br>
</div></div></blockquote></div><br><div style="font-size: 11px;"><img src="" style="font-size: 11px; width: 0px; min-height: 0px;"></div>
<div style="font-size: 11px;"></div><div style="font-size: 11px; text-align: left;">
        <div style="min-height: 50px;"><table style="min-height: 100%; border: 0pt none;"><tbody><tr><td style="border: 0pt none;"><img src="" alt=""></td>
</tr></tbody></table></div>

        <table style="width: 100%; border-style: none;" border="0" cellpadding="0" cellspacing="0">
            <tbody><tr>
                <td style="padding: 0pt; border: 0pt none; width: 100%; min-height: 51px;">
                    <table style="margin: 0pt; border: 0pt none; width: 100%; min-height: 100%;" cellpadding="0" cellspacing="0">
                        <tbody><tr>
                            <td style="padding: 0pt; border: 0pt none; background-repeat: no-repeat;" width="18px"> </td>
                            <td style="padding: 0pt; border: 0pt none; background-repeat: repeat-x; color: Gray;" align="right"> </td>
                            <td style="padding: 0pt; border: 0pt none; background-repeat: no-repeat;" align="left" valign="middle" width="38px">
                                <img src="" style="min-height: 25px; width: 25px;">
                            </td>
                        </tr>
                    </tbody></table>
                </td>
            </tr>
            <tr>
                <td style="padding: 0pt; border: 0pt none; width: 100%; min-height: 52px;">
                    <table style="margin: 0pt; border: 0pt none; width: 100%; min-height: 100%;" cellpadding="0" cellspacing="0">
                        <tbody><tr>
                            <td style="padding: 0pt; border: 0pt none; background-repeat: repeat-y;" width="2px">
                            </td>
                            <td style="padding: 0pt; border: 0pt none;">
                                <table style="margin: 0pt; width: 100%; min-height: 100%; border: 1px solid White;" cellpadding="0" cellspacing="0">
                                    <tbody><tr>
                                        <td style="padding: 0pt; border: 0pt none; background-repeat: repeat-y;" width="13px"> </td>
                                        <td style="padding: 0pt; border: 0pt none; background-repeat: repeat-x;" valign="middle">
                                        <table style="margin: 0pt; border: 0pt none;" cellpadding="0" cellspacing="0" height="100%" width="100%">
                                            <tbody><tr>
                                                <td style="padding: 0pt; border: 0pt none;" width="54px">
                                                    <img src="" alt="" style="vertical-align: middle;">
                                                </td>
                                                <td style="padding: 0pt; border: 0pt none;" width="10px"> </td>
                                                <td style="padding: 0pt; border: 0pt none;" width="10px">
                                                    <img src="" alt="" style="vertical-align: middle;">
                                                </td>
                                                <td style="padding: 0pt; border: 0pt none;" width="10px"> </td>
                                                <td style="padding: 0pt; border: 0pt none; color: White;"> </td>
                                                <td style="padding: 0pt; border: 0pt none;" width="10px"> </td>
                                            </tr>
                                        </tbody></table>
                                        
                                        </td>
                                        <td style="padding: 0pt; border: 0pt none; background-repeat: repeat-y;" width="13px"><img src="" height="1px" width="1px"></td>
                                    </tr>
                                </tbody></table>
                            </td>
                            <td style="padding: 0pt; border: 0pt none; background-repeat: repeat-y;" width="2px"><img src="" height="1px" width="1px"></td>
                        </tr> 
                    </tbody></table>
                </td>
            </tr>
        <tr>
            <td style="padding: 0pt; border: 0pt none; min-height: 100%; width: 100%;">
                    <table style="margin: 0pt; border: 0pt none; width: 100%; min-height: 100%;" cellpadding="0" cellspacing="0">
                        <tbody><tr>
                            <td style="padding: 0pt; border: 0pt none; background-repeat: repeat-y;" width="2px"><img src="" height="1px" width="1px"></td>
                            <td style="padding: 0pt; border: 0pt none; background-repeat: repeat;">
                                <table style="margin: 0pt; border: 0pt none;" cellpadding="0" cellspacing="0" width="100%">
                                    <tbody><tr>
                                        <td style="padding: 0pt; border: 0pt none;" width="15px"><img src="" height="1px" width="1px"></td>
                                        <td style="padding: 0pt; border: 0pt none; background-repeat: repeat;">
                                            <table style="border: 0pt none;" cellpadding="0" cellspacing="0" width="100%">
                                                <tbody><tr><td style="padding: 0pt; border: 0pt none;"><img src="" height="1px" width="1px"></td></tr>
                                                <tr>
                                                    <td style="padding: 0pt; border: 0pt none; font-weight: bold;">
                                                         
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="padding: 0pt; border: 0pt none;">
                                                         
                                                    </td>
                                                </tr>
                                                                                        <tr>
                                                    <td style="padding: 0pt; border: 0pt none;"><a href="#12d825de65ac2e0c_" style="color: rgb(0, 0, 222);"></a></td>

                                                </tr>
                                                <tr><td style="padding: 0pt; border: 0pt none;"><img src="" height="1px" width="1px"></td></tr>
                                            </tbody></table>
                                        </td>
                                        <td style="padding: 0pt; border: 0pt none; background-repeat: repeat-y;" width="2px"><img src="" height="1px" width="1px"></td>
                                    </tr>
                                    <tr>
                                        <td style="padding: 0pt; border: 0pt none; min-height: 40px;"><img src="" height="1px" width="1px"></td>
                                        <td style="padding: 0pt; border: 0pt none;">
                                            <table style="margin: 0pt; border: 0pt none;" cellpadding="0" cellspacing="0" height="100%" width="100%">
                                                <tbody><tr>
                                                    <td style="padding: 0pt; border: 0pt none;" valign="top">
                                                        <table style="margin: 0pt; border: 0pt none;" cellpadding="0" cellspacing="0" height="100%" width="100%">
                                                            <tbody><tr>
                                                                <td style="padding: 0pt; border: 0pt none;" height="0px" valign="middle" width="21px"><img src="" height="1px" width="1px"></td>
 
                                                                <td style="padding: 0pt; border: 0pt none;"><img src="" height="1px" width="1px"></td>

                                                            </tr>
                                                            <tr>
                                                                <td style="padding: 0pt; border: 0pt none;" height="0px" valign="middle"><img src="" height="1px" width="1px"></td> 
                                                                <td style="padding: 0pt; border: 0pt none;"><img src="" height="1px" width="1px"></td>

                                                            </tr>
                                                            <tr>
                                                                <td style="padding: 0pt; border: 0pt none;" height="0px" valign="middle"><img src="" height="1px" width="1px"></td> 
                                                                <td style="padding: 0pt; border: 0pt none;"><img src="" height="1px" width="1px"></td>

                                                            </tr>
                                                            <tr>
                                                                <td colspan="2" style="padding: 0pt; border: 0pt none;"><a href="#12d825de65ac2e0c_" style="text-decoration: underline; color: rgb(0, 0, 222);"></a></td>

                                                            </tr>
                                                        </tbody></table>
                                                    </td>
                                                    <td style="padding: 0pt; border-left: 1px solid Gray; border-bottom: 0pt none;" height="100%" width="10px"><img src="" height="1px" width="10px"></td>

                                                    <td style="padding: 0pt; border: 0pt none;" valign="top" width="50%">
                                                        <table style="margin: 0pt; border: 0pt none;" cellpadding="0" cellspacing="0" width="100%">
                                                            <tbody><tr>
                                                                <td colspan="2" style="padding: 0pt; border: 0pt none; font-weight: bold;" width="100%">
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td style="padding: 0pt; border: 0pt none;" height="0px" valign="middle" width="8px"><img src="" height="1px" width="1px"></td>
 
                                                                <td style="padding: 0pt; border: 0pt none;"><img src="" height="1px" width="1px"></td>
                                                            </tr>
                                                            <tr>
                                                                <td style="padding: 0pt; border: 0pt none;" height="0px" valign="middle"><img src="" height="1px" width="1px"></td> 
                                                                <td style="padding: 0pt; border: 0pt none;"><img src="" height="1px" width="1px"></td>
                                                            </tr>
                                                            <tr>
                                                                <td style="padding: 0pt; border: 0pt none;" height="0px" valign="middle"><img src="" height="1px" width="1px"></td> 
                                                                <td style="padding: 0pt; border: 0pt none;"><img src="" height="1px" width="1px"></td>
                                                            </tr>
                                                            <tr>
                                                                <td colspan="2" style="padding: 5px 0pt 0pt; border: 0pt none;">
                                                                    <a style="text-decoration: none; margin-right: 10px;" href="#12d825de65ac2e0c_"></a>
                                                                </td>
                                                            </tr>                                                        
                                                        </tbody></table>                                                    
                                                    </td>
                                                </tr>
                                            </tbody></table>
                                        </td>
                                        <td style="padding: 0pt; border: 0pt none;" width="10px"><img src="" height="1px" width="1px"></td>
                                    </tr>
                                    <tr><td colspan="3" style="padding: 0pt; border-left: 0pt none; border-bottom: 0pt none;" align="right" width="100%"><img src="" height="1px" width="1px"></td>
</tr>
                                    <tr>
                                        <td colspan="3" style="padding: 0pt; border: 0pt none; text-align: right;" align="right">
                                            <img src="" height="1px" width="1px"><a style="text-decoration: none; margin-right: 10px; color: rgb(0, 0, 222);" href="#12d825de65ac2e0c_"></a>
                                        </td>
                                    </tr>
                                </tbody></table>
                            </td>
                            <td style="padding: 0pt; border: 0pt none; background-repeat: repeat-y;" width="2px"><img src="" height="1px" width="1px"></td>
                        </tr>
                    </tbody></table>            
            </td>
        </tr>            
        <tr>
            <td style="padding: 0pt; border: 0pt none; width: 100%;">
                    <table style="margin: 0pt; border: 0pt none; width: 100%; min-height: 100%;" cellpadding="0" cellspacing="0">
                        <tbody><tr>
                            <td style="padding: 0pt; border: 0pt none; background-repeat: no-repeat;" height="9px" width="9px"><img src="" height="1px" width="1px"></td>
                            <td style="padding: 0pt; border: 0pt none; background-repeat: repeat-x;"><img src="" height="1px" width="1px"></td>
                            <td style="padding: 0pt; border: 0pt none; background-repeat: no-repeat;" width="9px"><img src="" height="1px" width="1px"></td>
                        </tr>
                    </tbody></table>            
            </td>
        </tr>            
        </tbody></table>


</div>
</div></div></blockquote></div><br>