Dear list members,<br><br>Thank you for this. 3 x C should be efficient enough.<br><br>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?<br>
<br>Thanks again,<br>Harry Spier<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">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 class="h5"><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">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; visibility: hidden; position: absolute; z-index: 11000; top: -100px;" id="ArrowLayer1d65mdl"><img style="font-size: 11px; width: 0px; height: 0px; position: absolute; z-index: 11001; top: 0px; left: 0px;" id="arrow_bg_image"></div>
<div style="font-size: 11px; visibility: hidden; position: absolute; z-index: 11000; top: -100px; background-image: url("sacore:inv.gif");" id="InvLayer1d65mdl"></div><div id="BubbleLayer1d65mdl" style="font-size: 11px; text-align: left; visibility: hidden; position: absolute; z-index: 11002; top: -100px;">
        <div style="position: absolute; left: 18px; top: 2px; height: 50px;" id="BALLOONLOGODIV1d65mdl"><table style="height: 100%; border: 0pt none;"><tbody><tr><td style="border: 0pt none;" id="BALLOONLOGO1d65mdl"><img alt="" src="sacore:empty.gif"></td>
</tr></tbody></table></div>
        <table id="BALLOON1d65mdl" style="width: 100%; cursor: default; -moz-user-select: none; border-style: none;" border="0" cellpadding="0" cellspacing="0">
         <tbody><tr>
         <td style="padding: 0pt; border: 0pt none; width: 100%; height: 51px;">
         <table id="HEADER_ROW1d65mdl" style="margin: 0pt; border: 0pt none; width: 100%; height: 100%;" cellpadding="0" cellspacing="0">
         <tbody><tr>
         <td id="HEADER_L1d65mdl" style="padding: 0pt; border: 0pt none; background-repeat: no-repeat;" width="18px"> </td>
         <td id="HEADER_C1d65mdl" style="padding: 0pt; border: 0pt none; background-repeat: repeat-x; color: Gray;" align="right"> </td>
         <td id="HEADER_R1d65mdl" style="padding: 0pt; border: 0pt none; background-repeat: no-repeat;" align="left" valign="middle" width="38px">
         <img id="closebutton1d65mdl" onclick="BubbleHide()" style="height: 25px; width: 25px;" src="sacore:empty.gif">
         </td>
         </tr>
         </tbody></table>
         </td>
         </tr>
         <tr>
         <td style="padding: 0pt; border: 0pt none; width: 100%; height: 52px;">
         <table style="margin: 0pt; border: 0pt none; width: 100%; height: 100%;" cellpadding="0" cellspacing="0">
         <tbody><tr>
         <td id="BANNER_BORDER_L1d65mdl" style="padding: 0pt; border: 0pt none; background-repeat: repeat-y;" width="2px">
         </td>
         <td style="padding: 0pt; border: 0pt none;">
         <table id="BANNER_ROW1d65mdl" style="margin: 0pt; width: 100%; height: 100%; border: 1px solid White;" cellpadding="0" cellspacing="0">
         <tbody><tr>
         <td id="BANNER_L1d65mdl" style="padding: 0pt; border: 0pt none; background-repeat: repeat-y;" width="13px"> </td>
         <td id="BANNER_C1d65mdl" style="padding: 0pt; border: 0pt none; background-repeat: repeat-x;" valign="middle">
         <table style="margin: 0pt; border: 0pt none;" cellpadding="0" cellspacing="0" width="100%" height="100%">
         <tbody><tr>
         <td id="ICON1d65mdl" style="padding: 0pt; border: 0pt none;" width="54px">
         <img alt="" src="sacore:empty.gif" style="vertical-align: middle;">
         </td>
         <td style="padding: 0pt; border: 0pt none;" width="10px"> </td>
         <td id="BANNER_SEP1d65mdl" style="padding: 0pt; border: 0pt none;" width="10px">
         <img alt="" src="sacore:empty.gif" style="vertical-align: middle;">
         </td>
         <td style="padding: 0pt; border: 0pt none;" width="10px"> </td>
         <td id="RECOMMENDATION1d65mdl" class="sastyle_text_overallrec" style="padding: 0pt; border: 0pt none; color: White;"> </td>
         <td style="padding: 0pt; border: 0pt none;" width="10px"> </td>
         </tr>
         </tbody></table>
        
         </td>
         <td id="BANNER_R1d65mdl" style="padding: 0pt; border: 0pt none; background-repeat: repeat-y;" width="13px"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         </tr>
         </tbody></table>
         </td>
         <td id="BANNER_BORDER_R1d65mdl" style="padding: 0pt; border: 0pt none; background-repeat: repeat-y;" width="2px"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         </tr>
         </tbody></table>
         </td>
         </tr>
<tr>
<td style="padding: 0pt; border: 0pt none; height: 100%; width: 100%;">
         <table id="BOTTOM_ROW1d65mdl" class="sastyle_text_contentclass" style="margin: 0pt; border: 0pt none; width: 100%; height: 100%;" cellpadding="0" cellspacing="0">
         <tbody><tr>
         <td id="BOTTOM_L1d65mdl" style="padding: 0pt; border: 0pt none; background-repeat: repeat-y;" width="2px"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         <td id="BOTTOM_C1d65mdl" style="padding: 0pt; border: 0pt none; background-repeat: repeat; background-position: left bottom;">
         <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="sacore:empty.gif" width="1px" height="1px"></td>
         <td id="" 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="sacore:empty.gif" width="1px" height="1px"></td></tr>
         <tr>
         <td id="SATITLE1d65mdl" class="sastyle_text_contentclass" style="padding: 0pt; border: 0pt none; font-weight: bold;">
        
         </td>
         </tr>
         <tr>
         <td id="DOMAIN1d65mdl" class="sastyle_text_contentclass" style="padding: 0pt; border: 0pt none;">
        
         </td>
         </tr>
                                                                                        <tr>
         <td id="WARN_TB1d65mdl" class="sastyle_link_moreinfo" style="padding: 0pt; border: 0pt none;"><a id="WARN_LINK1d65mdl" href="#" target="_blank" style="color: rgb(0, 0, 222);"></a></td>
         </tr>
         <tr><td style="padding: 0pt; border: 0pt none;"><img src="sacore:empty.gif" width="1px" height="1px"></td></tr>
         </tbody></table>
         </td>
         <td id="" style="padding: 0pt; border: 0pt none; background-repeat: repeat-y;" width="2px"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         </tr>
         <tr>
         <td style="padding: 0pt; border: 0pt none; height: 40px;"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         <td style="padding: 0pt; border: 0pt none;">
         <table style="margin: 0pt; border: 0pt none;" cellpadding="0" cellspacing="0" width="100%" height="100%">
         <tbody><tr>
         <td id="BOTTOM_LEFT1d65mdl" style="padding: 0pt; border: 0pt none;" valign="top">
         <table style="margin: 0pt; border: 0pt none;" cellpadding="0" cellspacing="0" width="100%" height="100%">
         <tbody><tr>
         <td id="FACET_IMAGE_01d65mdl" style="padding: 0pt; border: 0pt none;" valign="middle" width="21px" height="0px"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         <td id="FACET_RECCOMENDATION_01d65mdl" class="sastyle_text_facetrec" style="padding: 0pt; border: 0pt none;"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         </tr>
         <tr>
         <td id="FACET_IMAGE_11d65mdl" style="padding: 0pt; border: 0pt none;" valign="middle" height="0px"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         <td id="FACET_RECCOMENDATION_11d65mdl" class="sastyle_text_facetrec" style="padding: 0pt; border: 0pt none;"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         </tr>
         <tr>
         <td id="FACET_IMAGE_21d65mdl" style="padding: 0pt; border: 0pt none;" valign="middle" height="0px"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         <td id="FACET_RECCOMENDATION_21d65mdl" class="sastyle_text_facetrec" style="padding: 0pt; border: 0pt none;"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         </tr>
         <tr>
         <td colspan="2" class="sastyle_link_moreinfo" style="padding: 0pt; border: 0pt none;"><a id="DOSSIER_LINK1d65mdl" href="#" target="_blank" style="text-decoration: underline; color: rgb(0, 0, 222);"></a></td>
         </tr>
         </tbody></table>
         </td>
         <td id="BOTTOM_SEP1d65mdl" style="padding: 0pt; border-left: 1px solid Gray; border-bottom: 0pt none; visibility: hidden;" width="10px" height="100%"><img src="sacore:empty.gif" width="10px" height="1px"></td>
         <td id="BOTTOM_RIGHT1d65mdl" style="padding: 0pt; border: 0pt none;" class="sastyle_text_contentclass" valign="top" width="50%">
         <table style="margin: 0pt; border: 0pt none;" cellpadding="0" cellspacing="0" width="100%">
         <tbody><tr>
         <td id="CCHeader1d65mdl" colspan="2" class="sastyle_text_contentclass" style="padding: 0pt; border: 0pt none; font-weight: bold;" width="100%">
         </td>
         </tr>
         <tr>
         <td id="CC_IMAGE_01d65mdl" style="padding: 0pt; border: 0pt none;" valign="middle" width="8px" height="0px"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         <td id="CC_DESC_01d65mdl" class="sastyle_text_contentclass" style="padding: 0pt; border: 0pt none;"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         </tr>
         <tr>
         <td id="CC_IMAGE_11d65mdl" style="padding: 0pt; border: 0pt none;" valign="middle" height="0px"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         <td id="CC_DESC_11d65mdl" class="sastyle_text_contentclass" style="padding: 0pt; border: 0pt none;"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         </tr>
         <tr>
         <td id="CC_IMAGE_21d65mdl" style="padding: 0pt; border: 0pt none;" valign="middle" height="0px"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         <td id="CC_DESC_21d65mdl" class="sastyle_text_contentclass" style="padding: 0pt; border: 0pt none;"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         </tr>
         <tr>
         <td colspan="2" class="sastyle_link_moreinfo" style="padding: 5px 0pt 0pt; border: 0pt none;">
         <a style="text-decoration: none; margin-right: 10px;" id="CCDesc1d65mdl" href="#" target="_blank"></a>
         </td>
         </tr>        
         </tbody></table>        
         </td>
         </tr>
         </tbody></table>
         </td>
         <td style="padding: 0pt; border: 0pt none;" width="10px"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         </tr>
         <tr><td id="UPSELL_BORDER1d65mdl" colspan="3" style="padding: 0pt; border-left: 0pt none; border-bottom: 0pt none; visibility: hidden;" align="right" width="100%"><img id="UPSELL_SEP1d65mdl" src="sacore:empty.gif" width="1px" height="1px"></td>
</tr>
         <tr>
         <td id="UPSELL1d65mdl" colspan="3" style="padding: 0pt; border: 0pt none; text-align: right;" align="right">
         <img src="sacore:empty.gif" width="1px" height="1px"><a class="sastyle_link_upsell" style="text-decoration: none; margin-right: 10px; color: rgb(0, 0, 222);" id="UPSELL_LINK1d65mdl" href="#" target="_blank"></a>
         </td>
         </tr>
         </tbody></table>
         </td>
         <td id="BOTTOM_R1d65mdl" style="padding: 0pt; border: 0pt none; background-repeat: repeat-y;" width="2px"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         </tr>
         </tbody></table>
</td>
</tr>        
<tr>
<td style="padding: 0pt; border: 0pt none; width: 100%;">
         <table id="FOOTER_ROW1d65mdl" style="margin: 0pt; border: 0pt none; width: 100%; height: 100%;" cellpadding="0" cellspacing="0">
         <tbody><tr>
         <td id="FOOTER_L1d65mdl" style="padding: 0pt; border: 0pt none; background-repeat: no-repeat;" width="9px" height="9px"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         <td id="FOOTER_C1d65mdl" style="padding: 0pt; border: 0pt none; background-repeat: repeat-x;"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         <td id="FOOTER_R1d65mdl" style="padding: 0pt; border: 0pt none; background-repeat: no-repeat;" width="9px"><img src="sacore:empty.gif" width="1px" height="1px"></td>
         </tr>
         </tbody></table>
</td>
</tr>        
        </tbody></table>
</div>