On Tue, Sep 25, 2012 at 5:53 AM, Adrian Buehlmann <span dir="ltr"><<a href="mailto:adrian@cadifra.com" target="_blank">adrian@cadifra.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
V2 of experiment for a simpler path encoding for hashed paths (for "fncache2")<br></blockquote><div><br></div><div>Interesting approach.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+                       else if (i + 2 < len) {<br>
+                               c = encodechar(src[i]);<br>
+                               c1 = encodechar(src[i + 1]);<br>
+                               c2 = encodechar(src[i + 2]);<br>
+                               if ((c == 'a' && c1 == 'u' && c2 == 'x') ||<br>
+                                   (c == 'c' && c1 == 'o' && c2 == 'n') ||<br>
+                                   (c == 'p' && c1 == 'r' && c2 == 'n') ||<br>
+                                   (c == 'n' && c1 == 'u' && c2 == 'l') ||<br>
+                                   (c == 'c' && c1 == 'o' && c2 == 'm') ||<br>
+                                   (c == 'l' && c1 == 'p' && c2 == 't')) {<br></blockquote><div><br></div><div>This is going to do a lot of branching at the start of every path component. That's something that can be avoided quite easily using a state machine.</div>
<div><br></div><div>Otherwise, it looks decent (and now you know how tricky it is to write a supposedly simple C encoding function!). Have you looked into writing a pure Python version to see how complex it would be?</div>
</div>