[MERGE] get_record_stream().get_bytes_as('chunked')

John Arbash Meinel john at arbash-meinel.com
Thu Dec 11 15:22:34 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
>>>>>> "jam" == John Arbash Meinel <john at arbash-meinel.com> writes:
> 
> <snip/>
> 
>     jam> +        newline = <char *>memchr(c_str, c'\n', the_len)
>     jam> +        if newline != c_last and not (newline == NULL and cur == chunks_len):
>     >> 
>     >> Why don't you keep that construct in python ?
> 
>     jam> What construct is that?
> 
> The single iteration with a single test instead of special casing
> the last item (you may need to use enumerate in the list
> comprehension to get 'cur').

Well, technically, I do still special case the last item (cur == chunk_len).

I just get to do it with an if in C because it isn't as painful as the
python version.

> 
>     jam> I basically kept iterating the python one until I could
>     jam> find the fastest ops I could. Then I did a quick test
>     jam> pyrex implementation, and realized it was 5x faster than
>     jam> the best python I could write, so I spent more time on
>     jam> it.
> 
> Not a big deal, I'd prefer a more readable python version anyway.
> 
>         Vincent
> 

Sure.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklBMDoACgkQJdeBCYSNAAMtTwCeOMI7EqJs4xBVlcU+2QhjTh8d
pYUAn3GDgZK7D9+ErV4CL4n8oUp/NMRt
=QyHr
-----END PGP SIGNATURE-----



More information about the bazaar mailing list