Dnia 09-10-2007, Wt o godzinie 01:29 +0200, Christian Heimes pisze:

> I'm not happy with:
> 
>     static const char *quote_prefix = "buffer(b'";
>     p = PyUnicode_AS_UNICODE(v);
>     for (i=0; i<strlen(quote_prefix); i++) {
>         *p++ = quote_prefix[i];
>     }

strlen in a loop is bad for performance.

I would do:

   static const Py_UNICODE quote_prefix[] = {
      'b', 'u', 'f', 'f', 'e', 'r', '(', 'b', '\''
   };

and memcpy.

-- 
   __("<         Marcin Kowalczyk
   \__/       [EMAIL PROTECTED]
    ^^     http://qrnik.knm.org.pl/~qrczak/

_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to