For me, on both py27 and py35 (which I don't otherwise use), it's ~50% faster
to try:return dict[key]; except: pass than to test dict.get().
At least for the common case of "key in dict".

d=dict(a=1)
for i in range(1,999999):
        #x = d.get('a')
        #if x is not None: print (d['a'])

        try: print (d['a'])
        except: pass

So I think we should do that here:

|        # optimize for most frequent types
|        simple_type = cls._frequent_simple_types.get(type(value))
|        if simple_type:
|            return simple_type

- I believe you added that for me, to avoid many calls to isinstance().
Thanks :)

Justin
_______________________________________________
PyGreSQL mailing list
PyGreSQL@Vex.Net
https://mail.vex.net/mailman/listinfo/pygresql

Reply via email to