Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is DropBox's experience in using Python?

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

DropBox what is the experience of using Python, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

DropBox's experience with Python is shared:

1.1 Use Python

99.9% of Dropbox's code is written in Python. Python uses server-side, desktop client, website control logic, back-end API and analysis

On the Android platform, Python cannot be used due to memory constraints

Run a single code using the Python language. Make Dropbox run on Windows, Mac and Linux systems by using PyObjs, WxPython, types, py2exe, py2ap, PyWin32 and other tools

Advantages:

Developers communicate and express ideas with each other through Python

Easy to learn, easy to read, easy to write, and easy for newcomers to use.

Disadvantages:

Don't be silly

It consumes too much memory and runs too slowly. It's not a big problem on the server side, just buy a big machine. But on the client side, you can't expect old Power PC users to upgrade their devices.

Mixed Python and C programming can be problematic because it is difficult to imagine what you want to do with fixed memory and CPU across language boundaries (Coding in a mixed environment of Python and C creates problems because it's hard to profile across the language boundaries like you want to do when fixing memory and CPU problems. )

The memory fragmentation problem is that scripting languages may not be a good idea for a long-running process

1.2 make it work from the beginning (Just Work Baby)

No matter what file system you are, what operating system you are, or what application you use. The product should always just be able to work.

Python helps them iterate quickly by analyzing errors encountered on a wide variety of supported platforms.

1.3 early release (Release Early)

Code and publish it in a day, which is easy to do with Python

1.4 using C in a loop, it is easy to optimize CPU (Use C for Inner Loops, Optimizing CPU is easy)

It is a way to solve the problem that is too slow.

Optimize the internal loop to reduce CPU time.

It takes 44% more time to cycle in Python than in C

Python's virtual machine bytecode scheduling is very slow.

There are many tools to tune CPU.

CPU optimization is usually limited to small code snippets

1.5 polling is not easy to extend (Polling 30 million clients all over the world doesn't scale)

Establish a HTTP notification structure to prevent clients from polling the server.

1.6 Custom memory allocator, it is difficult to optimize memory

There was a problem for a while. A large amount of memory that can be used, but the memory is never freed. They can use the most 1.5GB for large synchronizations, and now they rarely use more than 100MB.

It's difficult because:

Few tools optimize memory for Python and C #

There are many reasons for memory inflation: memory leaks in Python and C code, memory fragmentation, and inefficient memory usage.

The inefficiency of fixed memory does not obviously help. They thought there was a memory leak, but it didn't.

The problem becomes a memory fragment. Memory fragmentation occurs when different sizes of memory blocks are constantly deleted and allocated. What is the case that continuous blocks of memory can no longer be allocated. CPython does not have a garbage collector, so all memory cannot be allocated at all and heap memory is growing.

The solution is to create a custom allocator. The metadata object of this file does a lot of growth transfer, so the obvious result is to create a custom allocator in C using mmap.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report