Looking for ideas to lower binding overhead for lua-re2. in plain-text)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Looking for ideas to lower binding overhead for lua-re2. in plain-text)

lua.greatwolf
>
> You should be using luaL_checklstring() here. You can pass a pointer _and_
> the length to the StringPiece constructor:
>
> size_t n;
> const char *p = luaL_checklstring(L, 2, &n);
> StringPiece subject(p, (int)n);
>  
> ...

Thank you for catching this! I did not realize the significance of this until resting a bit and
reviewing this with a fresh pair of eyes.

Now I feel like an idiot -- in hindsight I should have realized this was the problem. I even looked
at stringpiece.h at one point and saw that the constructor for StringPiece(const char *) *uses
strlen* to determine the length of the string. But alas, I didn't make the mental connection sooner
that this linear time operation was the root cause of the performance impact -- I should have though.

Fixing this silly oversight mitigates the overhead I was seeing. Thanks again and sorry for the noise!


Reply | Threaded
Open this post in threaded view
|

Re: Looking for ideas to lower binding overhead for lua-re2. in plain-text)

Ross Bencina
On 24/08/2013 1:11 PM, [hidden email] wrote:
> Fixing this silly oversight mitigates the overhead I was seeing.

Out of interest, what were the final C++/Python/Lua benchmark results?

Ross