On Thu, Jan 13, 2011 at 8:31 PM, Harry Spier <span dir="ltr"><<a href="mailto:vasishtha.spier@gmail.com">vasishtha.spier@gmail.com</a>></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'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'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've been told) functional programming constructs or copied from lisp type languages.<br>
4) Since I'm new to lisp like languages, I'm enjoying learning a new programming paradigm.<br><br>My only concern now is about "backward compatability" 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"><<a href="mailto:matthias@ccs.neu.edu" target="_blank">matthias@ccs.neu.edu</a>></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's FFI.<br>
<div><div></div><div><br>
<br>
On Jan 13, 2011, at 5:54 PM, Robby Findler wrote:<br>
<br>
> It is going to be hard to beat C. My experience is that on tight<br>
> nested loops like that where the loop body is simple and you write the<br>
> loop carefully you can get with 3x of C (or 2x since Matthew has<br>
> improved things since I last tried) but it is difficult to get to that<br>
> point.<br>
><br>
> Of course, if you want to actually write a real program around your<br>
> loop, then Racket is definitely a good choice. Also, if your loop is<br>
> parallelizable, you might want to try using futures.<br>
><br>
> In any case, a lot of these little core loops don't take too much time<br>
> to write, so you might try writing it a few times in a few languages<br>
> to see what you see.<br>
><br>
> Robby<br>
><br>
> On Thu, Jan 13, 2011 at 4:07 PM, Harry Spier <<a href="mailto:harryspier@hotmail.com" target="_blank">harryspier@hotmail.com</a>> wrote:<br>
>> Dear list members,<br>
>><br>
>> I am developing an OCR application. If written in an imperative language (<br>
>> C for example) it would spend most of its time traversing a 2 dimensional<br>
>> array. (I'm representing a black and white page of text as a rectangle of<br>
>> 0's and 1's). My first idea was to prototype in Ruby and then convert to C<br>
>> or to develop in Ruby with C extensions, but I'm wondering if I could do the<br>
>> whole development in Racket. I've seen somewhere (though I can't remember<br>
>> where) that Racket can be in the same order of efficiency as C .<br>
>><br>
>> But the crux issue is the efficiency of traversing the 2 dimensional array.<br>
>> I've noticed in the Racket Guide section 18.7 "Unchecked, Unsafe<br>
>> Operations" where it says "For tight loops that use these functions,<br>
>> avoiding checks can sometimes speed the computation, though the benefits<br>
>> vary for different unchecked functions and different contexts."<br>
>><br>
>> Have any list members ever compared the efficiency of nested C loops and how<br>
>> you would traverse a 2 dimensional array in Racket.<br>
>><br>
>> Thanks in advance,<br>
>> Harry Spier<br>
>><br>
>><br>
>> _________________________________________________<br>
>> For list-related administrative tasks:<br>
>> <a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br>
>><br>
> _________________________________________________<br>
> For list-related administrative tasks:<br>
> <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>