HN user

Anilm3

418 karma
Posts43
Comments22
View on HN
old.reddit.com 2y ago

Ubiquiti users report unauthorized access to other users' devices and cameras

Anilm3
4pts0
medium.com 3y ago

Home Assistant saves me 250€ every year

Anilm3
3pts0
www.smithsonianmag.com 4y ago

The gruesome history of eating corpses as medicine (2012)

Anilm3
27pts16
www.theguardian.com 4y ago

Baffling neurological illness affects growing number of young adults

Anilm3
243pts120
www.youtube.com 4y ago

C++20: Reaching for the Aims of C++ – Bjarne Stroustrup – CppCon 2021

Anilm3
2pts0
www.theguardian.com 5y ago

Any amount of alcohol consumption harmful to the brain, finds study

Anilm3
45pts11
nostarch.com 5y ago

C++ Crash Course: A Fast-Paced Introduction

Anilm3
1pts0
blog.logrocket.com 5y ago

Building web apps with Rust using the Rocket framework

Anilm3
1pts0
www.expressvpn.com 5y ago

ExpressVPN beta launches Lightway, a VPN protocol for the modern internet

Anilm3
1pts0
d-lab.mit.edu 6y ago

MIT D-Lab Learn-It – Adhesives

Anilm3
1pts0
akkadia.org 6y ago

Static Linking Considered Harmful

Anilm3
3pts1
www.ncbi.nlm.nih.gov 6y ago

A cluster randomised trial of cloth masks compared with medical masks (2015)

Anilm3
1pts0
www.youtube.com 6y ago

Read a Paper: Automatic Patch Generation by Learning Correct Code [video]

Anilm3
2pts0
people.csail.mit.edu 7y ago

Compress Objects, Not Cache Lines: An Object-Based Compressed Memory Hierarchy [pdf]

Anilm3
2pts0
cookingonabootstrap.com 7y ago

What (And Why) I’m Stockpiling for Brexit

Anilm3
3pts0
codekata.com 7y ago

CodeKata

Anilm3
2pts0
www.youtube.com 7y ago

Linux Sucks. Forever

Anilm3
3pts0
en.wikipedia.org 7y ago

Stuxnet

Anilm3
1pts0
www.forbes.com 7y ago

Why Are Robotics Companies Dying?

Anilm3
3pts0
www.vox.com 7y ago

I made 6 figures at my Facebook dream job, but couldn't afford the Bay Area

Anilm3
4pts0
zwischenzugs.com 8y ago

Anatomy of a Linux DNS Lookup – Part I

Anilm3
2pts0
jbremer.org 8y ago

Abusing Forced Inline in C (2012)

Anilm3
1pts0
www.somethingsimilar.com 8y ago

The opposite of a bloom filter

Anilm3
76pts25
www.independent.co.uk 9y ago

Scientists develop molecule that reverses antibiotic resistance

Anilm3
3pts0
www.deseat.me 9y ago

Deseat.me – clean up your existence

Anilm3
1pts0
www.ncameron.org 9y ago

Rust is about productivity

Anilm3
2pts0
getremarkable.com 9y ago

reMarkable

Anilm3
5pts1
github.com 9y ago

Simple Dynamic Strings

Anilm3
1pts0
www.garin.io 9y ago

Rust vs C Pitfalls

Anilm3
196pts365
www.wsj.com 9y ago

Bring Back Jobs from China? In Shenzhen, They Aren’t That Worried

Anilm3
1pts0

This is a very interesting concept and another example of what can be done with Rust. However and without the intention of discouraging the author, I did not find any performance improvement from Alacritty using Ubuntu 16.04 on an i7-4500U (using integrated graphics HD 4400). Here are some numbers, simply printing the contents of 446 files:

At 80x24:

gnome-terminal:

  real	0m0.848s
  user	0m0.032s
  sys	0m0.072s
Alacritty:
  real	0m6.832s
  user	0m0.032s
  sys	0m0.164s
At fullscreen:

gnome-terminal:

  real	0m0.819s
  user	0m0.020s
  sys	0m0.088s
Alacritty:
  real	0m8.972s
  user	0m0.064s
  sys	0m0.164s
The font was a tad smaller by default on Alacritty, changing it made no significant difference in the numbers. Since the difference in performance was quite noticeable I decided not to test other possible configurations, but I could do so if it might help.

My graphics card has a pretty poor performance in general so that might be an indication that, since the performance of Alacritty is directly impacted by the graphics card, it might be useful for the author to determine the "minimum requirements" for Alacritty to outperform the competition.

In any case, it might not be a fair comparison as the author has stated that this is a pre-alpha release, but maybe he can find it helpful in some way, as he suggests he hasn't been able to find a test in which Alacritty didn't perform as well as another terminal.

I don't see the point of the discussion, that piece of code (or relatively equivalent), is already being performed by a libC function (calloc, in this case), how is that less convenient than you writing it yourself?

It has nothing to do with how smart you are or how low level C is, you are effectively reinventing that part of calloc by wrapping malloc.

One of the most important reasons to use calloc, other than the zeroing of the allocated memory, is the fact that it checks for integer overflows (at least on most implementations).

For example, when allocating an array of n elements, in malloc you would do something like the following:

ptr = malloc(sizeof(int) * n);

Which could potentially lead to an overflow of the size passed to malloc, hence allocating a significantly smaller buffer and end up accessing adjacent memory which hasn't been allocated to the buffer (buffer overflow)

Calloc requires two arguments, one for size and one for number of elements, which allows it to check for an overflow before performing an allocation (e.g. by using SIZE_MAX):

ptr = calloc(n, sizeof(int));

This is not to say that zeroing memory is not useful. There are many situations in which a zero in a memory block represents the end of the usable data, as for example in a string, so zeroing memory in those situations is definitely recommended.

Very interesting article! I like the fact that you mentioned Prolog as one of the less mainstream languages to learn. During my time at uni I found that both Haskell and Prolog really changed the way I approached different problems and gave me a high level perspective to problem solving. Some interesting resources to learn Prolog:

# http://www.swi-prolog.org/

# http://people.cs.kuleuven.be/~bart.demoen/PrologProgrammingC...

# http://www.cs.bham.ac.uk/~pjh/prolog_module/sem242.html

# http://www.learnprolognow.org/

I'm getting an itch now, I think I'll give Prolog a second go this new year.

I agree that it's important to unplug every once in a while, but for some, programming is like reading. As an analogy consider a lawyer reading legal documents all day at work and going back home and reading a novel, it's exactly the same for me, working on my own projects is exciting and enjoyable.

I agree he was pretty harsh, just keep trying if that's what you really want, someday you'll get it right.

But please, there are numerous adjectives that can be used to describe coding and sexy just isn't one of them.