Re: Performance of PyUnicode Issue #2100

Jim Baker <[email protected]>
Newsgroups gmane.comp.lang.jython.devel
Message-ID <CAOhO=aON-rMNQXaJD2WZHqnAbRRsGCj_dz48nD6gj-2qewm4Xw@mail.gmail.com>
Jeff,

+1

This is fantastic work, with very readable code and corresponding algorithm
around the index translation. Looking forward to seeing it merged in!

- Jim


On Thu, Sep 11, 2014 at 2:53 PM, Jeff Allen <[email protected]> wrote:

>  I've implemented the indexing idea now, and it makes most unicode
> operations on long-ish strings a lot faster, without significantly harming
> BMP performance. Two change sets are worth a look. (I'm pushing to
> Bitbucket to avoid a whole series of merges.)
>
> The first adds the idea of index translation, but accomplishes it using
> String methods that have to count code points:
>
> https://bitbucket.org/tournesol/jython-ja/commits/191a9854396d5ba742d4b2d3179647eb632aa6d0#Lsrc/org/python/core/PyUnicode.javaT132
>
> That one is correct but slow. Then the second one provides the index that
> makes access fast.
>
> https://bitbucket.org/tournesol/jython-ja/commits/b96c8402f7baff86b86a002194a3b50d6903a04c
>
> The bug I noticed (in find) is fixed by the sequence of changes, and
> others I've found (replace, endswith, startswith) where arguments defining
> a slice were not dealt with correctly. I think I've found them all, but
> maybe not. A couple of other things I want to do:
>
> 1. speed up slicing, using the same technique, where easy. I'll try to
> resist more complex cases, like how we do strided slices, although I think
> there's scope.
>
> 2. positively reject strings that include lone surrogates of any kind. At
> present, I only catch leading surrogates without a trailing surrogate.
>
> Shout if any of this looks wrong.
>
> Jeff
>
> Jeff Allen
>
> On 02/09/2014 19:11, Jeff Allen wrote:
>
> JMH is worth the learning curve. I have quite informative benchmarks now
> for the table building and index translation. thanks for the pointer.
>
> Jeff Allen
>
> On 19/08/2014 08:15, Jeff Allen wrote:
>
> Interesting links, thanks. Caliper seems to have a good approach and
> explains itself well. I had experimented with the flags it uses to detect
> how many repeats might be needed to make recompilation stop. JMH looks
> harder to apply. (I found a tutorial elsewhere.) Overall I quite like that
> my test is in Python, but I can see uses for these either in the next phase
> and where I might have used them in the past.
>
> Jeff Allen
>
> On 17/08/2014 09:55, Indra Talip wrote:
>
> Jeff,
> Two tools that I've seen that have a reasonable reputation for being able
> to create reliable micro benchmarks on the JVM are JMH [1] and Caliper [2].
> I've not used either but my understanding is that they are suited to that
> sort of benchmarking and handle the vagaries of the JIT compiler.
>
>  [1] http://openjdk.java.net/projects/code-tools/jmh/
>  [2] https://code.google.com/p/caliper/
>
>
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds.  Stuff that matters.http://tv.slashdot.org/
>
>
>
> _______________________________________________
> Jython-dev mailing [email protected]://lists.sourceforge.net/lists/listinfo/jython-dev
>
>
>
>
> ------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce
> Perforce version control. Predictably reliable.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> _______________________________________________
> Jython-dev mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jython-dev
>
>


-- 
- Jim

jim.baker@{colorado.edu|python.org|rackspace.com|zyasoft.com}
twitter.com/jimbaker
github.com/jimbaker
bitbucket.com/jimbaker

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk

_______________________________________________
Jython-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.