9,867 karma · joined Aug 20, 2015 (11y ago) · 5,528 submissions
comment 4y ago · link · parent
Here are the results that I got from my Linux system. I excluded all user-visible applications (like Firefox, terminal, ssh or text editor) and added up what was remanining. This includes systemd, system services like udevd, Gnome, user services like pulseaudio. Total memory consumption is 730 Megabytes (RAM + SWAP added).
I think the reasons for such high memory consumption are that Gnome shell is written in Javascript (gnome-shell alone uses 200 Mb) and there are many small daemons: for example, NTFS daemon uses 30 Mb, Xwayland uses 45 Mb, IME daemons use around 55 Mb and so on. Most daemons use somewhere around 5-15 Mb but there are so many of them that the result is this big.
For comparison, Firefox processes use somewhere around 1.2 Gb, Skype (Electron-based) uses 600 Mb, and desktop Telegram uses 600 Mb as well despite being written in C++.
If you wish to try this on your system, you can use this Python script: [1]. Don't forget to edit `get_group()` method to exclude user-visible applications (or close them). You need to run the script as root because otherwise you will be able to read only your own `smaps_rollup` files. The script also saves detailed stats in CSV format into /tmp/ram.csv.
If you don't want to use my script you can use htop and enable PSS and SWAP columns there (and you can remove useless SHR/RES).
[1] https://gist.github.com/codedokode/ddaedf4ae44cbfa16ca44dde6...
comment 4y ago · link · parent
To count the memory properly, you should divide size of shared segments by number of processes using it. This is how PSS in Linux is implemented. You can safely add PSS values of different processes. If you have swap, you should also sum swap usage by processes.
As I understand, you can reliably count memory usage only in Linux because other OSes like Windows or Mac do not provide PSS in their Task Managers. Windows Task Manager at least has a documentation that describes what "memory" column means, and I failed to find such documentation for Mac, so we can safely assume that it displays random numbers remotely related to memory usage.
comment 4y ago · link · parent
At least 18, or more if local government considers it reasonable to raise the age.
> Are they not permitted to do some research or reach out to supportive online communities?
They are permitted as long as they use only compliant sites. Talking to random strangers about this is not a good idea.
comment 4y ago · link · parent
I propose to make it illegal to help kids to obtain access to adult Internet the same way as it is illegal to help them to buy alcohol.
comment 4y ago · link · parent
The only way protect children online is to ban them from Internet. Children should not have access to normal laptops and smartphones, instead they should use "kid phones". Such phones would allow children to communicate only with people approved by parents or teachers and visit only approved sites. This way they will enjoy perfect safety which this Bill fails to provide.
Every site which wants to become approved, must fulfill all the requirements from the Bill and indicate this with a HTTP header. Kid phones and laptops should allow only to visit such compliant sites.
Kid-oriented phones and laptops must be visually distinctive: for example, have a shape of a cute animal. In this case teachers, parents or police will be able to instantly spot and confiscate illegal devices.
This is a win-win plan: kids would be safe and adults would be safe from government overreach. Obviously no government will agree to such plan.
comment 4y ago · link · parent
Make a customizable and privacy-respecting search for us, power users.
Also, I have noticed that Firefox internal search works good for sites you had visited. So when I want to visit a page I have seen earlier, I can go straight to it skipping Google.
Also, you can click on any search box and add it with a prefix, so that you can search MDN or Wikipedia directly, again, without informing Google.
[1] https://source.chromium.org/chromium/chromium/src/+/main:com...
comment 4y ago · link · parent
Another example is phone support. AI is already being used there, for example, in some banks (in Russia) you are first greeted by a robot if you call, and only if it cannot answer your question it will let you talk to the human.
comment 4y ago · link · parent
- increase screen size to at least 15.5" because small screen is unusable for programming and for browsing modern websites with large font size and large pictures
- use IPS panel (can increase cost)
- make arrow keys full size (doesn't cost anything)
- add 7 keys for additional Cyrillic letters and 2 keys to switch between layouts (doesn't cost anything)
- add 3 USB ports and Ethernet (doesn't noticeably increase cost)
- increase RAM limit to 128 Gb (shouldn't cost anything, it is probably just a software limitation)
- use standard 3.5mm audio jacks
Using a better LCD panel can increase cost, so here is how this can be conpensated:
- use an older cheaper CPU. Newest CPUs usually have lower performance to cost ratio and therefore it doesn't make sense to buy them. Also why pay for 10 cores when most of the time you will be using 1 or 2?
- support cheaper HDD instead of SSD
- remove unnecessary speakers
- remove unnecessary keyboard backlight. Using laptop in darkness is bad for eyes anyway.
Also I am surprised that a modern i7 CPU that costs over $470 has just 12Mb cache. You can (probably) buy an old CPU with more cache for smaller price.
comment 4y ago · link · parent
Also, if Apple allowed other browser engines with better support for new features, then web developers might stop caring about supporting Safari. This might be another reason why Apple doesn't want other browsers on their devices.
comment 4y ago · link · parent
And a book on Rust [2] says:
> A string slice is a reference to part of a String
This seems wrong, because &str can reference static strings which are not String. And if str, or "string slice" is a "reference", then &str is a reference to a reference?
And later:
> The type that signifies “string slice” is written as &str
But the documentation said that "string slice" is str, not &str.
Also, I wonder, what do square brackets mean when they are used without an ampersand (as s[0..2] instead of &s[0..2])?
Also, is an ampersand in &str the same as an ampersand in &u8 (meaning an immutable reference to u8) or does it have other meaning?
[1] https://doc.rust-lang.org/std/primitive.str.html
[2] https://doc.rust-lang.org/book/ch04-03-slices.html#string-sl...
comment 4y ago · link · parent
UPD: I looked at the compiled code and currently it is unlikely to be optimized. Also this page [1] shows that the code run in browser can be up to 1000 times slower than in a native Python interpreter.
comment 4y ago · link · parent
Also, it is unlikely that compiling to WASM will be more effective than to native code because browser cannot afford spending as much time on optimization as a native compiler. Therefore WASM will always be slower than a native code.
If you want to benefit from amazing optimizations that were done for JS, then it is better to transpile your Python code directly into JS.
comment 4y ago · link · parent
For example, JS has no classes and uses prototype inheritance, and you can even change prototype at runtime. This is absolutely useless, inconvenient feature and it makes optimization (like JIT compilation) much more difficult (for example, before calling a method you must ensure that the prototype didn't change, the method was not replaced and so on).
In 95% (arbitrary number) of cases you just need classes with a fixed set of fields and methods known at compile time, which is very optimizer-friendly.
comment 4y ago · link · parent
I can only imagine how many people will just close the tab and move to next search result.
comment 4y ago · link · parent
Of course if you are writing an internal app and can provide M2 MacBook to every employee, then it is totally fine. But if you are writing applications for wide audience, it is a different thing.
I remember that one of early users of Vkontakte (a Russian clone of Facebook) was impressed that the site was loading fast on his old computer. As I remember, its JS code was written in vanilla JS without libraries like jQuery. Today the hardware is better, but if you will run SQLAlchemy in a browser to save development cost, your site's loading time won't impress users.
comment 4y ago · link · parent
I think it would be great if more people would be able to create web applications, but there should be better technologies than shipping a ten-megabytes interpreter with every HTML page.
Also Python is not easy for non-developers. It might be easy for middle school level tasks like replacing a word in a string. However if you want to use a database, you have to learn about object-oriented programming, property descriptors, ORM and decorators, all of these are difficult topics and libraries like SQLAlchemy are not for beginners (just look at its documentation. It doesn't even explain what ORM means).
comment 4y ago · link · parent
Python is not a fast language. For example, consider a simple loop:
for i in range(10):
pass
In Python, this will be compiled into: a call to range(), heap allocation of an Iterable, calling getIterator() on an Iterable (which might also do allocation), calling next() on an Iterator while catching for StopIteration exception (and calls are often slow in interpreted languages). While in C we could just have a loop without any calls.I remember how I had to use a Dart-based web application (compiled to JS) in one of Google's advertising products. The script weighed around several megabytes and everything was so slow. Furthermore, there also was a small and useless "what's new" applet, and it probably was shipped with a separate copy of Dart runtime because it weighed several megabytes too. Obviously this was a product intended to be used only on latest MacBooks, not on a Windows XP laptop.
It is totally fine to write such application for youself, or maybe for internal use, but if you are a corporation with millions of users, I think you should pay a little attention to performance and choose a better technology. Or, if you are of a Google scale, find a way to optimize the code.
comment 4y ago · link · parent
> The breach has so far cost US bank Capital One, one of the 30 institutions affected, more than $270m in compensation and regulatory fines.
The bank claims that it is hacker's fault.
But isn't it wrong? Bank was fined and sued not for having been a victim of a hack but for not storing data securily, not configuring the cloud accounts properly. For not following required procedures. Therefore, as I understand, the bank should have been fined even if there were no breach.
Or are they blaming the hacker for exposing the violations? Do they assume that it is ok to violate regulations as long as nobody knowns about it? That's ridiculous.