Atualizámos a nossa política de privacidade. Clique aqui para ver os detalhes. Toque aqui para ver os detalhes.
Ative o seu período de avaliaçõo gratuito de 30 dias para desbloquear leituras ilimitadas.
Ative o seu teste gratuito de 30 dias para continuar a ler.
Baixar para ler offline
Did you know that Python preallocates integers from -5 to 257? Reusing them 1000 times, instead of allocating memory for a bigger integer, can save you a couple milliseconds of code’s execution time. If you want to learn more about this kind of optimizations then, … well, probably this presentation is not for you :) Instead of going into such small details, I will talk about more “sane” ideas for writing faster code.
After a brief overview of how you can speed up your Python code in general, we will dig into source code optimization. I will show you some simple and fast ways of measuring the execution time of your code, and then we will discuss examples of how to improve some common code structures.
You will see:
* The fastest way of removing duplicates from a list
* How much faster your code is when you reuse the built-in functions instead of trying to reinvent the wheel
* What is faster than the “for loop”
* If the lookup is faster in a list or a set
* When it’s better to beg for forgiveness than to ask for permission
Did you know that Python preallocates integers from -5 to 257? Reusing them 1000 times, instead of allocating memory for a bigger integer, can save you a couple milliseconds of code’s execution time. If you want to learn more about this kind of optimizations then, … well, probably this presentation is not for you :) Instead of going into such small details, I will talk about more “sane” ideas for writing faster code.
After a brief overview of how you can speed up your Python code in general, we will dig into source code optimization. I will show you some simple and fast ways of measuring the execution time of your code, and then we will discuss examples of how to improve some common code structures.
You will see:
* The fastest way of removing duplicates from a list
* How much faster your code is when you reuse the built-in functions instead of trying to reinvent the wheel
* What is faster than the “for loop”
* If the lookup is faster in a list or a set
* When it’s better to beg for forgiveness than to ask for permission
Parece que você já adicionou este slide ao painel
Você recortou seu primeiro slide!
Recortar slides é uma maneira fácil de colecionar slides importantes para acessar mais tarde. Agora, personalize o nome do seu painel de recortes.A família SlideShare acabou de crescer. Desfrute do acesso a milhões de ebooks, áudiolivros, revistas e muito mais a partir do Scribd.
Cancele a qualquer momento.Leitura ilimitada
Aprenda de forma mais rápida e inteligente com os maiores especialistas
Transferências ilimitadas
Faça transferências para ler em qualquer lugar e em movimento
Também terá acesso gratuito ao Scribd!
Acesso instantâneo a milhões de e-books, audiolivros, revistas, podcasts e muito mais.
Leia e ouça offline com qualquer dispositivo.
Acesso gratuito a serviços premium como Tuneln, Mubi e muito mais.
Atualizámos a nossa política de privacidade de modo a estarmos em conformidade com os regulamentos de privacidade em constante mutação a nível mundial e para lhe fornecer uma visão sobre as formas limitadas de utilização dos seus dados.
Pode ler os detalhes abaixo. Ao aceitar, está a concordar com a política de privacidade atualizada.
Obrigado!