On Sun, 24 Nov 2013 10:09:53 -0800 (PST) wgw <wgwin...@gmail.com> wrote:
> I'm not a developer (though I have some aspirations in that direction), but > I would say: this is great, and no distraction at all. It is useful for me > to see how code can be polished. > > At the same time, to facilitate the incorporation of tweaks into the code, > you might consider setting up a bzr account. That would make it a snap to > fold your optimizations into Leo. The benefit of optimizations is always hard to measure, unless you, um, measure it. If you know there's a bottleneck that's slowing things down and can target that, that's probably going to help. Optimizing code that's called very infrequently or accounts for a tiny proportion of runtime may not have a noticeable effect. So then it becomes a questions of clarity and safety. In the tab expansion case I guess the simpler version would be clearer - I also guess it wasn't used because str.expandtabs because not everyone's aware of it, I wasn't. The safety thing is a question of what the code does. Changes in optional plugins are usually relatively safe. Changes in core code, particularly load/save have to be approached much more carefully. Where possible unit tests can make changes safer. For changes via bzr - we've never really pinned down policy on this, whatever Edward says ;-) Inkscape has a "two patches reviewed and accepted and you get commit access" policy. In terms of how to submit a patch for those two reviewed cases, or whatever, creating you own branch on launchpad and generating a merge request is probably the most convenient, for reviewers anyway. Cheers -Terry > Best, > > Bill > > On Sunday, 24 November 2013 08:53:39 UTC-8, Reinhard Engel wrote: > > > > Some other function: The second one is short and faster than the first. > > > > def computeLeadingWhitespaceWidth (s,tab_width): > > > > w = 0 > > for ch in s: > > if ch == ' ': > > w += 1 > > elif ch == '\t': > > w += (abs(tab_width) - (w % abs(tab_width))) > > else: > > break > > return w > > > > > > def computeLeadingWhitespaceWidth2(s, tab_width): > > t = s.expandtabs(abs(tab_width)) > > return len(t) - len(t.lstrip()) > > > > > > I don't know - are such micro-optimizations welcome or just a distraction? > > > > > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at http://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/groups/opt_out.